OFFSET
0,3
COMMENTS
LINKS
PROG
(PARI) a(n) = { my (v=0, k); while (n, n-=2^k=valuation(n, 2); v+=([0, 1, 0; 0, 0, 1; 1, 1, 1]^(3+k))[2, 1]); return (v); }
(Python)
def A356964(n):
a, b, c, s = 1, 2, 4, 0
for i in bin(n)[-1:1:-1]:
s += int(i)*a
a, b, c = b, c, a+b+c
return s # Chai Wah Wu, Sep 10 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Sep 06 2022
STATUS
approved