program Hello;
var n: Int64;
maxsteps, steps : smallint;
begin
writeln ('Hello World');
//steps := 1;
n := 0;
maxsteps := 0;
for n := 2 to 13 do
begin
steps := 1;
while (n <> 1) do
begin
if odd(n) then n:= 3*n+1
else n:= trunc(n/2);
inc(steps);
end;
if steps > maxsteps then maxsteps := steps;
end;
writeln(maxsteps);
end.
No comments:
Post a Comment