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.

A051065 a(n) = A004128(n) mod 2.

Original entry on oeis.org

0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1
Offset: 0

Views

Author

Keywords

References

  • Letter from Gary W. Adamson concerning Prouhet-Thue-Morse sequence, Nov. 11, 1999.

Crossrefs

Programs

  • Mathematica
    Join[{0}, Mod[Accumulate[Table[IntegerExponent[3*n, 3], {n, 1, 100}]], 2]] (* Amiram Eldar, Jun 02 2025 *)
  • PARI
    a(n)=if(n<1,0,(a(n\3)+n)%2) \\ Benoit Cloitre, Nov 21 2013
  • Python
    TOP = 1000
    a = [0]*TOP
    for n in range(1, TOP):
        print(a[n-1], end=',')
        a[n] = (n + a[n//3]) % 2
    # Alex Ratushnyak, Aug 17 2012
    
  • Python
    def A051065(n):
        c, m, a = 1, 3*n, 0
        for k in range(1,n+1):
            c *= 3
            if c > m:
                break
            a ^= m//c&1
        return a # Chai Wah Wu, Sep 02 2025
    

Formula

a(0)=0, a(n) = (n + a(floor(n/3))) mod 2. - Alex Ratushnyak, Aug 17 2012

Extensions

More terms from James Sellers, Dec 11 1999