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.

A371442 For any positive integer n with binary digits (b_1, ..., b_w) (where b_1 = 1), the binary digits of a(n) are (b_1, b_3, ..., b_{2*ceiling(w/2)-1}); a(0) = 0.

Original entry on oeis.org

0, 1, 1, 1, 2, 3, 2, 3, 2, 2, 3, 3, 2, 2, 3, 3, 4, 5, 4, 5, 6, 7, 6, 7, 4, 5, 4, 5, 6, 7, 6, 7, 4, 4, 5, 5, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, 4, 4, 5, 5, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, 8, 9, 8, 9, 10, 11, 10, 11, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12
Offset: 0

Views

Author

Rémy Sigrist, Mar 24 2024

Keywords

Comments

In other words, we keep odd-indexed bits.
For any v > 0, the value v appears A003945(A070939(v)) times in the sequence.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     1      10          1
   3     1      11          1
   4     2     100         10
   5     3     101         11
   6     2     110         10
   7     3     111         11
   8     2    1000         10
   9     2    1001         10
  10     3    1010         11
  11     3    1011         11
  12     2    1100         10
  13     2    1101         10
  14     3    1110         11
  15     3    1111         11
		

Crossrefs

See A371459 for the sequence related to even-indexed bits.
See A059905 and A063694 for similar sequences.

Programs

  • Mathematica
    A371442[n_] := FromDigits[IntegerDigits[n, 2][[1;;-1;;2]], 2];
    Array[A371442, 100, 0] (* Paolo Xausa, Mar 28 2024 *)
  • PARI
    a(n) = { my (b = binary(n)); fromdigits(vector(ceil(#b/2), k, b[2*k-1]), 2); }
    
  • Python
    def a(n): return int(bin(n)[::2], 2)

Formula

a(A000695(n)) = n.
a(A001196(n)) = n.
a(A165199(n)) = a(n).