Hofstadter Figure-Figure sequences: Difference between revisions
Content added Content deleted
(Realize in F#) |
(Updated to compile with Nim 1.4) |
||
Line 1,561: | Line 1,561: | ||
let x = cr[cr.high] + cs[cr.high] |
let x = cr[cr.high] + cs[cr.high] |
||
cr.add x |
cr.add x |
||
for y in cs[cs.high] + 1 .. |
for y in cs[cs.high] + 1 ..< x: cs.add y |
||
cs.add x + 1 |
cs.add x + 1 |
||
proc ffr(n): int = |
proc ffr(n: int): int = |
||
assert n > 0 |
assert n > 0 |
||
while n > cr.len: extendRS() |
while n > cr.len: extendRS() |
||
cr[n - 1] |
cr[n - 1] |
||
proc ffs(n): int = |
proc ffs(n: int): int = |
||
assert n > 0 |
assert n > 0 |
||
while n > cs.len: extendRS() |
while n > cs.len: extendRS() |