Collatz Problem by *yuko*(LF)

program-id.y.data division.working-storage section.
1 n pic 9999.
procedure division.accept n
if n="1"move 22 to n.if n="2"move 54 to n.if n=""move 6 to n.a.compute
n=n/2+(1+n/.4)*function mod(n,2)display
n(4- function log10(n):)if n>1 go a.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page