Jump to content

Hailstone sequence: Difference between revisions

Line 5,896:
 
=== Nested function call formulation ===
<lang Mathematica>HailstoneF[n_] := NestWhileList[If[OddQ@[#], 3 # + 1, #/2] &, n, # > 1 &]</lang>
 
This is probably the most readable and shortest implementation.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.