Hailstone sequence: Difference between revisions
Content added Content deleted
m (→{{header|FutureBasic}}: Inserted code indents) |
m (→{{header|FutureBasic}}: Tweak indents again) |
||
Line 4,559: | Line 4,559: | ||
<syntaxhighlight lang="futurebasic"> |
<syntaxhighlight lang="futurebasic"> |
||
local fn Hailstone( n as NSInteger ) as NSInteger |
local fn Hailstone( n as NSInteger ) as NSInteger |
||
NSInteger count = 1 |
NSInteger count = 1 |
||
while ( n != 1 ) |
while ( n != 1 ) |
||
if ( n and 1 ) == 1 |
if ( n and 1 ) == 1 |
||
n = n * 3 + 1 |
n = n * 3 + 1 |
||
⚫ | |||
end if |
|||
⚫ | |||
count++ |
count++ |
||
wend |
|||
⚫ | |||
⚫ | |||
wend |
|||
end fn = count |
end fn = count |
||