[go: up one dir, main page]

login
A324288
a(n) = A002487(1+A005187(n)).
7
1, 1, 1, 3, 1, 4, 5, 2, 1, 5, 7, 3, 7, 2, 5, 8, 1, 6, 9, 4, 10, 3, 8, 13, 9, 2, 7, 12, 8, 11, 10, 7, 1, 7, 11, 5, 13, 4, 11, 18, 13, 3, 11, 19, 13, 18, 17, 12, 11, 2, 9, 16, 12, 17, 18, 13, 11, 14, 13, 10, 18, 11, 4, 13, 1, 8, 13, 6, 16, 5, 14, 23, 17, 4, 15, 26, 18, 25, 24, 17, 16, 3, 14, 25, 19, 27, 29, 21, 18, 23, 22, 17, 31, 19, 7, 23, 13, 2
OFFSET
0,4
FORMULA
a(n) = A002487(1+A005187(n)).
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; };
A324288(n) = A002487(1+A005187(n));
(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