OFFSET
1,2
FORMULA
From Robert Israel, Jan 21 2016: (Start)
G.f.: A(x) = Sum_{j >= 0} (1-x^(10^j))/((1-x)*(1-x^(10^(j+1)))) * Sum_{d=1..9} d*(d+1)/2 * x^(d*10^j)
satisfies A(x) = (1-x^10)*A(x^10)/(1-x) + (1+3*x^2+6*x^3+10*x^4+15*x^5+21*x^6+28*x^7+36*x^8+45*x^9)/(1-x^10).
a(10*m + j) = a(m) + j*(j+1)/2 for 0 <= j <= 9. (End)
EXAMPLE
a(12) = 1*2/2 + 2*3/2 = 4.
MAPLE
seq(add(d*(d+1)/2, d = convert(n, base, 10)), n=1..1000); # Robert Israel, Jan 21 2016
MATHEMATICA
f[n_]:=Total[IntegerDigits[n]*(IntegerDigits[n]+1)/2]; f/@Range@100
PROG
(PARI) a(n) = {my(d = digits(n)); sum(k=1, #d, d[k]*(d[k]+1)/2); } \\ Michel Marcus, Jan 12 2016
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Ivan N. Ianakiev, Jan 12 2016
STATUS
approved