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.

A301572 a(n) = distance from n to nearest Fibbinary number (A003714).

Original entry on oeis.org

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

Views

Author

Altug Alkan and Rémy Sigrist, Mar 23 2018

Keywords

Comments

This sequence is unbounded.

Examples

			a(12) = a(14) = 2 because 10 is the nearest Fibbinary number to 12 and 16 is the nearest Fibbinary number to 14.
		

Crossrefs

Cf. A003714.

Programs

  • PARI
    a(n) = for (k=0, oo, if (bitand(n-k, 2*(n-k))==0 || bitand(n+k, 2*(n+k))==0, return (k)))

Formula

a(n) = 0 iff n belongs to A003714.
0 <= 2 * a(n) - a(2 * n) <= 1.