OFFSET
0,6
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..8191
FORMULA
PROG
(Scheme, three 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==0)*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