[go: up one dir, main page]

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

%I #14 Mar 26 2018 02:04:40

%S 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,

%T 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,

%U 1,0,0,1,1,0,0,0,1,2,3,2,1,0,0,0,1,0,0

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

%C This sequence is unbounded.

%H Altug Alkan, <a href="/A301572/b301572.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Di#distance_to_the_nearest">Index entries for sequences related to distance to nearest element of some set</a>

%F a(n) = 0 iff n belongs to A003714.

%F 0 <= 2 * a(n) - a(2 * n) <= 1.

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

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

%Y Cf. A003714.

%K nonn,base,look

%O 0,13

%A _Altug Alkan_ and _Rémy Sigrist_, Mar 23 2018