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.

A071412 A002487 mod 3.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jul 15 2002

Keywords

References

  • E. Dijkstra, Selected Writings on Computing, Springer, 1982, p. 232 (sequence is called fusc).

Programs

  • Python
    from functools import reduce
    def A071412(n): return sum(reduce(lambda x,y:(x[0],(x[0]+x[1])%3) if int(y) else ((x[0]+x[1])%3,x[1]),bin(n)[-1:2:-1],(1,0)))%3 if n else 0 # Chai Wah Wu, May 18 2023