OFFSET
0,4
LINKS
PROG
(PARI)
A002487(n) = { my(s=sign(n), a=1, b=0); n = abs(n); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (s*b); }; \\ Modified from the one given in A002487, sign not actually needed here.
A005187(n) = { my(s=n); while(n>>=1, s+=n); s; };
(Python)
from functools import reduce
def A324288(n): return sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(1+(n<<1)-n.bit_count())[-1:2:-1], (1, 0))) if n else 1 # Chai Wah Wu, May 05 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 20 2019
STATUS
approved