Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- int main(void) {
- uint32_t min, max;
- uint32_t i, temp, vmax, count;
- while (scanf("%d %d\n", &min, &max) == 2) {
- vmax = 0;
- for (i = min; i <= max; i++) {
- temp = i;
- count = 1;
- while(temp != 1) {
- if (temp % 2 == 0) temp = temp / 2;
- else temp = 3 * temp + 1;
- count++;
- }
- if (count > vmax) vmax = count;
- }
- printf("%d %d %d\n", min, max, vmax);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement