OFFSET
0,2
LINKS
FORMULA
G.f.: (1 - x)/(1 - 22x + 40*x^2).
a(n) = 2^(n-1)*(19*10^n - 1)/9.
a(n) = 22*a(n-1) - 40*a(n-2).
E.g.f.: exp(2*x)*(19*exp(18*x) - 1)/18. - Stefano Spezia, Apr 03 2023
EXAMPLE
2^2 to 2^3-1 = 4 through 7 = 100, 101, 110 and 111 in binary and when summed = 422.
MATHEMATICA
Table[Total[FromDigits[IntegerDigits[#, 2]]&/@(Range[2^n, 2^(n+1)-1])], {n, 0, 20}] Harvey P. Dale, May 20 2012
PROG
(PARI) a(n)=if(n<0, 0, 2^(n-1)*(19*10^n-1)/9)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
N. J. A. Sloane, May 15 2003
STATUS
approved