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.

A189822 Positions of 1 in A189820; complement of A003278.

Original entry on oeis.org

3, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 33, 34, 35, 36, 39, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 84
Offset: 1

Views

Author

Clark Kimberling, Apr 28 2011

Keywords

Crossrefs

Programs

  • Mathematica
    a[1] = 0; h = 50;
    Table[a[3 k - 2] = a[k], {k, 1, h}];
    Table[a[3 k - 1] = a[k], {k, 1, h}];
    Table[a[3 k] = 1, {k, 1, h}];
    Flatten[Position[%%, 1]]
  • Python
    from gmpy2 import digits
    def A189822(n):
        def f(x):
            l = (s:=digits(x-1,3)).find('2')
            if l >= 0: s = s[:l]+'1'*(len(s)-l)
            return n+1+int(s,2)
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Dec 05 2024