RosettaCodeData/Task/Fusc-sequence/11l/fusc-sequence.11l

19 lines
432 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

F fusc(n)
V res = [0] * n
res[1] = 1
L(i) 2 .< n
res[i] = I i % 2 == 0 {res[i I/ 2]} E res[(i-1) I/ 2] + res[(i+1) I/ 2]
R res
print(First 61 terms:)
print(fusc(61))
print()
print(Points in the sequence where an item has more digits than any previous items:)
V f = fusc(20'000'000)
V max_len = 0
L(i) 0 .< f.len
I String(f[i]).len > max_len
max_len = String(f[i]).len
print((i, f[i]))