OFFSET
0,2
LINKS
Lorenzo Cococcia, Table of n, a(n) for n = 0..999
EXAMPLE
a(6) = 10:
The binary representation of 6 is 110.
digit h
1 0 O
/ \
1 1 O O
/ \ / \
0 2 O O O O
| | | |
O O O O
thus number of edges is 10.
PROG
(Python 3)
def a(n):
t=1
edges=0
for digit in bin(n)[2:]:
t=t*(int(digit)+1)
edges=edges+t
return edges
print([a(n) for n in range(0, 100)])
(PARI) a(n) = if (n==0, 0, if (n==1, 2, 2^hammingweight(n) + a(n\2))); \\ Michel Marcus, Aug 17 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Lorenzo Cococcia, Jul 31 2015
STATUS
approved