OFFSET
0,2
FORMULA
n>0, a(n) = (1/3)*(8*2^(floor(log(n)/log(2)))+(-1)^(floor(log(n)/log(2)))).
PROG
(PARI) a(n)=if(n<1, 1, (1/3)*(8*2^(floor(log(n)/log(2)))+(-1)^(floor(log(n)/log(2)))))
(Python)
def A098971(n): return ((1<<(m:=n.bit_length()+2))+(1 if m&1 else -1))//3 # Chai Wah Wu, Oct 10 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Oct 23 2004
STATUS
approved