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.

A103542 Binary equivalents of A102370.

Original entry on oeis.org

0, 11, 110, 101, 100, 1111, 1010, 1001, 1000, 1011, 1110, 1101, 11100, 10111, 10010, 10001, 10000, 10011, 10110, 10101, 10100, 11111, 11010, 11001, 11000, 11011, 11110, 111101, 101100, 100111, 100010, 100001, 100000, 100011, 100110, 100101
Offset: 0

Views

Author

N. J. A. Sloane, Mar 23 2005

Keywords

Comments

The number of 1's in the n-th term appears to match A089400. - Benoit Cloitre, Mar 24 2005

Programs

  • Mathematica
    f[n_] := Block[{k = 1, s = 0, l = Max[2, Floor[Log[2, n + 1] + 2]]}, While[k < l, If[ Mod[n + k, 2^k] == 0, s = s + 2^k]; k++ ]; s]; Table[ FromDigits[ IntegerDigits[f[n] + n, 2]], {n, 0, 35}] (* Robert G. Wilson v, Mar 23 2005 *)
  • Python
    def a(n): return '0' if n<1 else bin(sum([(n + k)&(2**k) for k in range(len(bin(n)[2:]) + 1)]))[2:] # Indranil Ghosh, May 03 2017

Extensions

More terms from Robert G. Wilson v and Benoit Cloitre, Mar 23 2005