[go: up one dir, main page]

login
A339310
a(n) = a(n-1-a(n-1)) + a(n-a(n-2)) for n>2; starting with a(1) = a(2) = 1.
0
1, 1, 2, 3, 3, 3, 5, 4, 6, 5, 6, 8, 8, 6, 9, 8, 8, 11, 11, 10, 10, 14, 12, 11, 16, 15, 12, 17, 14, 17, 16, 18, 14, 19, 19, 16, 21, 22, 19, 21, 25, 18, 22, 25, 23, 24, 25, 25, 23, 31, 28, 22, 33, 28, 29, 32, 28, 29, 30, 30, 33, 35, 29, 33, 32, 28, 41, 36, 35
OFFSET
1,3
COMMENTS
{a(n)} is the Pinn F 1,0(n) sequence (see link section).
LINKS
K. Pinn, A Chaotic Cousin Of Conway's Recursive Sequence, arXiv:cond-mat/9808031 [cond-mat.stat-mech], 1998.
EXAMPLE
a(3)=2 because a(3) = a(3-1-a(3-1))+a(3-a(3-2)) = a(2-1)+a(3-1) = 1+1 = 2.
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = a[n - 1 - a[n - 1]] + a[n - a[n - 2]]; Table[ a[n], {n, 1, 40}]
PROG
(Python3)
a=[1, 1]
for n in range(100):
i1=len(a)-1-a[len(a)-1]
i2=len(a)-a[len(a)-2]
if i1>=0 and i2>=0 :
a.append(a[i1]+a[i2])
else :
print("Sequence dies. Contains ", n+2, " terms.")
break
print(a)
(PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; va[2] = 1; for (n=3, nn, va[n]=va[n-1-va[n-1]]+va[n-va[n-2]]; ); va; } \\ Michel Marcus, Dec 07 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Pablo Hueso Merino, Dec 02 2020
STATUS
approved