cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A339310 a(n) = a(n-1-a(n-1)) + a(n-a(n-2)) for n>2; starting with a(1) = a(2) = 1.

Original entry on oeis.org

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

Views

Author

Pablo Hueso Merino, Dec 02 2020

Keywords

Comments

{a(n)} is the Pinn F 1,0(n) sequence (see link section).

Examples

			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.
		

Crossrefs

Programs

  • 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}]
  • 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
  • Python
    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)