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.

A006940 Rows of Pascal's triangle mod 3.

Original entry on oeis.org

1, 11, 121, 1001, 11011, 121121, 1002001, 11022011, 121212121, 1000000001, 11000000011, 121000000121, 1001000001001, 11011000011011, 121121000121121, 1002001001002001, 11022011011022011, 121212121121212121, 1000000002000000001, 11000000022000000011, 121000000212000000121
Offset: 0

Views

Author

Keywords

Comments

Subsequence of A118594. - Chai Wah Wu, Jul 30 2025

References

  • C. Pickover, Mazes for the Mind, St. Martin's Press, NY, 1992, p. 353.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits[Table[Mod[Binomial[n, k], 3], {k, 0, n}]]; Array[a, 25, 0] (* Amiram Eldar, Nov 22 2018 *)
  • PARI
    a(n)=fromdigits(apply(x->x%3, binomial(n))); \\ Michel Marcus, Nov 21 2018
    
  • Python
    from math import prod, comb
    from gmpy2 import digits
    def A006940(n):
        if n==0: return 1
        c, l = '', len(s:=digits(n,3))
        for k in range(m:=n+2>>1):
            t = digits(k,3).zfill(l)
            c += str(prod(comb(int(s[i]),int(t[i]))%3 for i in range(l))%3)
        return int(c+c[m-2+(n&1)::-1]) # Chai Wah Wu, Jul 30 2025

Extensions

More terms from Michel Marcus, Nov 21 2018