OFFSET
0,2
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..1000
FORMULA
a(n) = b^2 + (n+1-b)*(n-b), where b = 2^A000120(n). - Andrew Howroyd, Feb 02 2020
EXAMPLE
Triangle A160019 begins : 1 ; 1,3 ; 1,0,3 ; 1,3,5,7 ; 1,0,2,4,3 ; 1,3,0,2,5,7 ; ...
PROG
(PARI) \\ here S(n, k) is A047999.S(n, k)={bitand(n-k, k)==0}a(n)={my(b=0); sum(k=0, n, if(S(n, k), b++; 2*b-1, 2*(k-b)))} \\ Andrew Howroyd, Feb 02 2020
(PARI) a(n)={my(b=2^hammingweight(n)); b^2 + (n+1-b)*(n-b)} \\ Andrew Howroyd, Feb 02 2020
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Philippe Deléham, Apr 29 2009
EXTENSIONS
Terms a(11) and beyond from Andrew Howroyd, Feb 02 2020
STATUS
approved