Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Hailstone-sequence/11l/hailstone-sequence.11l
Normal file
12
Task/Hailstone-sequence/11l/hailstone-sequence.11l
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
F hailstone(=n)
|
||||
V seq = [n]
|
||||
L n > 1
|
||||
n = I n % 2 != 0 {3 * n + 1} E n I/ 2
|
||||
seq.append(n)
|
||||
R seq
|
||||
|
||||
V h = hailstone(27)
|
||||
assert(h.len == 112 & h[0.<4] == [27, 82, 41, 124] & h[(len)-4 ..] == [8, 4, 2, 1])
|
||||
|
||||
V m = max((1..99999).map(i -> (hailstone(i).len, i)))
|
||||
print(‘Maximum length #. was found for hailstone(#.) for numbers <100,000’.format(m[0], m[1]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue