24 lines
529 B
Plaintext
24 lines
529 B
Plaintext
procedure main(args)
|
|
n := integer(!args) | 27
|
|
task2(n)
|
|
write()
|
|
task3()
|
|
end
|
|
|
|
procedure task2(n)
|
|
count := 0
|
|
every writes(" ",right(!(sequence := hailstone(n)),5)) do
|
|
if (count +:= 1) % 15 = 0 then write()
|
|
write()
|
|
write(*sequence," value",(*sequence=1,"")|"s"," in the sequence.")
|
|
end
|
|
|
|
procedure task3()
|
|
maxHS := 0
|
|
every n := 1 to 100000 do {
|
|
count := *hailstone(n)
|
|
if maxHS <:= count then maxN := n
|
|
}
|
|
write(maxN," has a sequence of ",maxHS," values")
|
|
end
|