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.

A378299 Read the binary representation of n from the most to least significant bit then perform a cumulative XOR and store by reading from least to most significant bit.

Original entry on oeis.org

0, 1, 1, 2, 1, 6, 2, 5, 1, 14, 6, 9, 2, 13, 5, 10, 1, 30, 14, 17, 6, 25, 9, 22, 2, 29, 13, 18, 5, 26, 10, 21, 1, 62, 30, 33, 14, 49, 17, 46, 6, 57, 25, 38, 9, 54, 22, 41, 2, 61, 29, 34, 13, 50, 18, 45, 5, 58, 26, 37, 10, 53, 21, 42, 1, 126, 62, 65, 30, 97, 33, 94
Offset: 0

Views

Author

DarĂ­o Clavijo, Nov 22 2024

Keywords

Comments

a(n) is Gray-coded into the reversed binary representation of n.
Fixed points are 0 and f(n) = 8*f(n-1) + 5 with f(1)=1 or f(n) = (1/14)*(3*(2^(3*n))-10) for n >= 1 (cf. A380001).

Examples

			For n = 75 a(75) = 78 because:
75 in base 2 is 1001011 and in base 2:
  m      | x = x XOR (m AND 1) | o
---------+---------------------+----------
1001011  | 1 = 0 XOR 1         |       1
100101   | 0 = 1 XOR 1         |      10
10010    | 0 = 0 XOR 0         |     100
1001     | 1 = 0 XOR 1         |    1001
100      | 1 = 1 XOR 0         |   10011
10       | 1 = 1 XOR 0         |  100111
1        | 0 = 1 XOR 1         | 1001110
And 1001110 in base 10: 78
		

Crossrefs

Programs

  • Mathematica
    A378299[n_] := FromDigits[FoldList[BitXor, 0, Reverse[IntegerDigits[n, 2]]], 2];
    Array[A378299, 100, 0] (* Paolo Xausa, Dec 13 2024 *)
  • Python
    def a(n):
      m,x,o = n,0,0
      while m > 0:
        x ^= (m & 1)
        o <<= 1
        o |= x
        m >>=1
      return o
    print([a(n) for n in range(0,71)])

Formula

a(n) = A006068(A030101(n)).
a(A000079(n)) = 1.
a(A007283(n)) = 2.
a(A000225(n)) = A000975(n).
a(A000051(n)) = A095121(n).