OFFSET
1,1
COMMENTS
LINKS
Hugo Pfoertner and Robert G. Wilson v, Table of n, a(n) for n = 1..1000
MATHEMATICA
f[n_] := If[OddQ@ n, 2^(n/2 + 1/2), Block[{k = IntegerExponent[n, 2] - 1}, 2^(n/2 - 1) + 2^((n/2 - 2^k)/(2^(k + 1)))]]; Array[f, 41] (* Robert G. Wilson v, Aug 08 2011 *)
PROG
(Python)
def a(n):
if n%2: return 2**((n + 1)//2)
k=bin(n - 1)[2:].count('1') - bin(n)[2:].count('1')
return 2**(n//2 - 1) + 2**((n//2 - 2**k)//(2**(k + 1)))
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 29 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Tony Bartoletti, Feb 20 2011
STATUS
approved