OFFSET
0,3
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..8192
FORMULA
PROG
(Scheme, two different implementations)
(PARI)
a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2)));
a(n) = (hammingweight(n)%2)*a065620(n);
for(n=0, 100, print1(a(n), ", ")) \\ Indranil Ghosh, Jun 07 2017
(Python)
def a065620(n): return n if n<3 else 2*a065620(n//2) if n%2==0 else -2*a065620((n - 1)//2) + 1
def a(n): return (bin(n)[2:].count("1")%2)*a065620(n)
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 18 2014
STATUS
approved