Search found 1 match

by pez
Mon May 12, 2003 6:09 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320039

Some tricks

Hi!

Maybe this help a little:
while N <> 1 do begin
if odd(N) then begin
{n := 3*n + 1; - result is not odd, so divide by 2}
N := N + ((N + 1) div 2);
cl := cl + 2;
continue;
end else N := N div 2;
cl := cl + 1;
end;

Go to advanced search