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.

A330772 a(n) = 1 for n<1; for n >= 0, a(n+1) = 2*a(n-a(n)).

Original entry on oeis.org

2, 2, 2, 4, 2, 4, 4, 4, 8, 4, 8, 4, 8, 4, 8, 8, 8, 16, 4, 16, 8, 16, 8, 16, 8, 16, 8, 8, 32, 2, 16, 16, 16, 16, 32, 4, 32, 4, 32, 8, 32, 16, 32, 16, 16, 64, 2, 32, 16, 32, 32, 8, 32, 16, 8, 4, 16, 64, 2, 32, 16, 32, 4, 4, 64, 4, 64, 4, 8, 32, 8, 8, 8, 128
Offset: 1

Views

Author

Rok Cestnik, Dec 30 2019

Keywords

Comments

From the current term count back the same number of terms and double it to obtain the next term. Because a(n) can exceed n, negative indexes are also occasionally referenced.

Examples

			a(1) = 2*a(0-a(0)) = 2*a(-1) = 2.
a(2) = 2*a(1-a(1)) = 2*a(-1) = 2.
a(3) = 2*a(2-a(2)) = 2*a(0) = 2.
a(4) = 2*a(3-a(3)) = 2*a(1) = 4.
		

Crossrefs

Programs

  • Python
    a = [2]
    for n in range(1000):
        if(a[n] > n):
            a.append(2)
        else:
            a.append(2*a[n-a[n]])