Hey, I did some research on my own about this and made a 3x+1 calculator. Here’s the code:
local bestNum = 1
function calc(n, nFormed) -- 3x+1 calculation
if n <= 1 then
return nFormed
end
if n % 2 ~= 0 then
n = (n * 3) + 1
else
n = n / 2
end
return calc(n, nFormed + 1)
end
for i = 1, 1000000000000 do
local val = calc(i, 1)
if val > bestNum then
bestNum = val -- save best result as highest val from calculation
print(i, bestNum, "numbers formed")
end
end
and here are the formatted data I collected over a long period of running this code:
number: 1 | formed 0 total numbers
number: 2 | formed 1 total numbers
number: 3 | formed 7 total numbers
number: 6 | formed 8 total numbers
number: 7 | formed 16 total numbers
number: 9 | formed 19 total numbers
number: 18 | formed 20 total numbers
number: 25 | formed 23 total numbers
number: 27 | formed 111 total numbers
number: 54 | formed 112 total numbers
number: 73 | formed 115 total numbers
number: 97 | formed 118 total numbers
number: 129 | formed 121 total numbers
number: 171 | formed 124 total numbers
number: 231 | formed 127 total numbers
number: 313 | formed 130 total numbers
number: 327 | formed 143 total numbers
number: 649 | formed 144 total numbers
number: 703 | formed 170 total numbers
number: 871 | formed 178 total numbers
number: 1,161 | formed 181 total numbers
number: 2,223 | formed 182 total numbers
number: 2,463 | formed 208 total numbers
number: 2,919 | formed 216 total numbers
number: 3,711 | formed 237 total numbers
number: 6,171 | formed 261 total numbers
number: 10,971 | formed 267 total numbers
number: 13,255 | formed 275 total numbers
number: 17,647 | formed 278 total numbers
number: 23,529 | formed 281 total numbers
number: 26,623 | formed 307 total numbers
number: 34,239 | formed 310 total numbers
number: 35,655 | formed 323 total numbers
number: 52,527 | formed 339 total numbers
number: 77,031 | formed 350 total numbers
number: 106,239 | formed 353 total numbers
number: 142,587 | formed 374 total numbers
number: 156,159 | formed 382 total numbers
number: 216,367 | formed 385 total numbers
number: 230,631 | formed 442 total numbers
number: 410,011 | formed 448 total numbers
number: 511,935 | formed 469 total numbers
number: 626,331 | formed 508 total numbers
number: 837,799 | formed 524 total numbers
number: 1,117,065 | formed 527 total numbers
number: 1,501,353 | formed 530 total numbers
number: 1,723,519 | formed 556 total numbers
number: 2,298,025 | formed 559 total numbers
number: 3,064,033 | formed 562 total numbers
number: 3,542,887 | formed 583 total numbers
number: 3,732,423 | formed 596 total numbers
number: 5,649,499 | formed 612 total numbers
number: 6,649,279 | formed 664 total numbers
number: 8,400,511 | formed 685 total numbers
number: 11,200,681 | formed 688 total numbers
number: 14,934,241 | formed 691 total numbers
number: 15,733,191 | formed 704 total numbers
number: 31,466,382 | formed 705 total numbers
number: 36,791,535 | formed 744 total numbers
number: 63,728,127 | formed 949 total numbers
number: 127,456,254 | formed 950 total numbers
-----------------------------------------------
lua + luajit results (quicker processing time)
-----------------------------------------------
number: 169,941,673 | formed 954 total numbers
number: 226,588,897 | formed 957 total numbers
number: 268,549,803 | formed 965 total numbers
number: 537,099,606 | formed 966 total numbers
number: 670,617,279 | formed 987 total numbers
number: 1,341,234,558 | formed 988 total numbers
number: 1,412,987,847 | formed 1001 total numbers
number: 1,674,652,263 | formed 1009 total numbers
number: 2,610,744,987 | formed 1051 total numbers
number: 4,578,853,915 | formed 1088 total numbers
number: 4,890,328,815 | formed 1132 total numbers
Edit: I do realise this is a year old post but its relevant and interesting - thanks for whoever reads this.