User talk:Fullstop/Sandbox/T2

int main(void) /* empirically test Collatz' 3n+1 conjecture */ {  unsigned long min, max;
 * 1) include 

while (fscanf(stdin, "%lu %lu\n", &min, &max) == 2) { unsigned long mm = min, max_cycle_len = 0; while (mm <= max) { unsigned long cycle_len = 0; unsigned long n = mm++;

for { cycle_len++; if (n == 1) break; if (n & 1) n += (n << 1) | 1; else n >>= 1; }         if (cycle_len > max_cycle_len) max_cycle_len = cycle_len; }     printf("%lu %lu %lu\n", min, max, max_cycle_len); }  return 0; }