login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the greatest Fibonacci number f such that f AND n = f (where AND denotes the bitwise AND operator).
2

%I #12 Mar 02 2024 08:00:27

%S 0,1,2,3,0,5,2,5,8,8,8,8,8,13,8,13,0,1,2,3,0,21,2,21,8,8,8,8,8,21,8,

%T 21,0,1,34,34,0,5,34,34,8,8,34,34,8,13,34,34,0,1,34,34,0,21,34,55,8,8,

%U 34,34,8,21,34,55,0,1,2,3,0,5,2,5,8,8,8,8,8,13

%N a(n) is the greatest Fibonacci number f such that f AND n = f (where AND denotes the bitwise AND operator).

%C From _Robert Israel_, Mar 01 2024: (Start)

%C a(n) is the greatest Fibonacci number f <= n such that there are no carries in the base-2 addition of f and n-f.

%C a(n) is the greatest Fibonacci number f such that binomial(n, f) is odd. (End)

%H Rémy Sigrist, <a href="/A370744/b370744.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) <= n with equality iff n is a Fibonacci number.

%p Fib:= [seq(combinat:-fibonacci(n),n=0..100)]:

%p f:= proc(n) local m,k;

%p m:= ListTools:-BinaryPlace(Fib,n+1);

%p for k from m by -1 do

%p if MmaTranslator:-Mma:-BitAnd(Fib[k],n) = Fib[k] then return Fib[k] fi

%p od

%p end proc:

%p map(f, [$0..100]); # _Robert Israel_, Mar 01 2024

%o (PARI) a(n) = { my (v = 0, f); for (k = 2, oo, f = fibonacci(k); if (f > n, return (v), bitand(f, n)==f, v = f);); }

%Y Cf. A000045, A370730.

%K nonn,base

%O 0,3

%A _Rémy Sigrist_, Feb 29 2024