Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,33 @@
get "libhdr"
// Generate the N'th term of the Recaman sequence
// given terms 0 to N-1.
let generate(a, n) be
a!n := n=0 -> 0, valof
$( let subterm = a!(n-1) - n
let addterm = a!(n-1) + n
if subterm <= 0 resultis addterm
for i=0 to n-1
if a!i = subterm resultis addterm
resultis subterm
$)
let start() be
$( let a = vec 50 and n = 15 and rep = ?
writef("First %N members:*N", n)
for i = 0 to n-1
$( generate(a, i)
writef("%N ", a!i)
$)
writef("*NFirst repeated term:*N")
rep := valof
$( generate(a, n)
for i = 0 to n-1
if a!i = a!n resultis n
n := n + 1
$) repeat
writef("a!%N = %N*N", rep, a!rep)
$)