login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A370744
a(n) is the greatest Fibonacci number f such that f AND n = f (where AND denotes the bitwise AND operator).
2
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, 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, 34, 34, 8, 21, 34, 55, 0, 1, 2, 3, 0, 5, 2, 5, 8, 8, 8, 8, 8, 13
OFFSET
0,3
COMMENTS
From Robert Israel, Mar 01 2024: (Start)
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.
a(n) is the greatest Fibonacci number f such that binomial(n, f) is odd. (End)
LINKS
FORMULA
a(n) <= n with equality iff n is a Fibonacci number.
MAPLE
Fib:= [seq(combinat:-fibonacci(n), n=0..100)]:
f:= proc(n) local m, k;
m:= ListTools:-BinaryPlace(Fib, n+1);
for k from m by -1 do
if MmaTranslator:-Mma:-BitAnd(Fib[k], n) = Fib[k] then return Fib[k] fi
od
end proc:
map(f, [$0..100]); # Robert Israel, Mar 01 2024
PROG
(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); ); }
CROSSREFS
Sequence in context: A272591 A339694 A074722 * A331102 A080368 A057174
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 29 2024
STATUS
approved