Your formula is the same as mine, only a few more brackets
Guess you have made some other optimization which prevents from computing these numbers which do not fit in Int32. Or which data type do you use?
Huh, this sounds like the incredible n:=n+n shr 1+1 tweak which delays the crashing point by some numbers. Arr... guess you did not mean that, it would be way too easy. :lol: Finding (n*3+1)div 2 without "doing it"... sounds a little bit lunatic. I am glad there is another insane here :lol: :lol:
You'd better install free pascal if you want to solve more problems. I see there are good arguments for doing so :-?
There are two 64-bit integer types Int64 (signed) and QWord (unsigned), but you don't need them for this problem; standard integer (32-bit, signed) is enough. Are you sure? I ...
[c]printf("%2i:", pos);[/c] This is similar to the Pascal code [pascal]write(pos:2,':');[/pascal] which reproduces the sample output with leading blanks in front of 0-9, but generates a presentation error. The correct output should be achieved by [c]printf("%i:", pos);[/c] or the Pascal version ...
I used a workaround for the problem in PASCAL, combining 2 longints and thus emulating 48bit integers which were long enough.
I wonder if you could use the (AFAIK) 64bit integer type "comp", which I think is only part of Borland (Turbo) Pascal. Is there a similar integer type in freepascal?