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.

A066203 a(1) = 2; a(2) = 1; for n > 2, a(n) = a(n-1)-(n-1) if this is positive and has not already appeared in the sequence, otherwise a(n) = a(n-1)+(n-1).

Original entry on oeis.org

2, 1, 3, 6, 10, 5, 11, 4, 12, 21, 31, 20, 8, 21, 7, 22, 38, 55, 37, 18, 38, 17, 39, 16, 40, 15, 41, 14, 42, 13, 43, 74, 106, 73, 107, 72, 36, 73, 35, 74, 34, 75, 33, 76, 32, 77, 123, 170, 122, 171, 121, 70, 122, 69, 123, 68, 124, 67, 9, 68, 128, 189, 127, 64, 128, 63, 129, 62
Offset: 1

Views

Author

N. J. A. Sloane, Dec 16 2001

Keywords

Crossrefs

A variant of A005132. A row of the array in A066202.

Programs

  • Python
    l=[0, 2, 1]
    for n in range(3, 101):
        x=l[n - 1] - (n - 1)
        if x>0 and x not in l: l.append(x)
        else: l.append(l[n - 1] + (n - 1))
    print(l[1:]) # Indranil Ghosh, Jun 02 2017

Extensions

More terms from Sascha Kurz, Mar 24 2002