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.

A374355 a(n) is the least fibbinary number f <= n such that n - f is also a fibbinary number whose binary expansion has no common 1's with that of f (where fibbinary numbers correspond to A003714).

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 1, 4, 4, 4, 5, 0, 0, 0, 1, 0, 0, 2, 2, 8, 8, 8, 9, 8, 8, 10, 10, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 1, 4, 4, 4, 5, 16, 16, 16, 17, 16, 16, 18, 18, 16, 16, 16, 17, 20, 20, 20, 21, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 1, 4, 4, 4, 5, 0
Offset: 0

Views

Author

Rémy Sigrist, Jul 06 2024

Keywords

Comments

To compute a(n): replace every other bit with zero (starting with the first bit) in each run of consecutive 1's in the binary expansion of n.

Examples

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

Crossrefs

Programs

  • PARI
    a(n) = { my (v = 0, e, x, y, b); while (n, x = y = 0; e = valuation(n, 2); for (k = 0, oo, if (bittest(n, e+k), n -= b = 2^(e+k); [x, y] = [y + b, x], v += y; break;););); return (v); }

Formula

a(n) = A374354(n, 0).
a(n) = n - A374356(n).
a(n) >= 0 with equality iff n is a fibbinary number.