A156230 Sum of the products of the digits of n and the positions of the digits m in n starting from the last digit.
1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 3
Offset: 1
Examples
a(19) = 9*1 + 1*2 = 11.
Programs
-
Maple
A156230 := proc(n) local dgs; dgs := convert(n,base,10) ; add(i*op(i,dgs),i=1..nops(dgs)) ; end proc: seq(A156230(n),n=1..100) ; # R. J. Mathar, Dec 02 2018
-
Mathematica
pdn[n_]:=Module[{idn=IntegerDigits[n]},Total[idn Range[Length[idn],1,-1]]]; Array[pdn,80] (* Harvey P. Dale, Aug 22 2012 *)
-
PARI
gr(n) = v=Vec((rev(n)));sum(x=1,length(v),x*eval(v[x])) gr1(n) = for(j=1,n,print1(gr(j)",")) rev(str) = /* Get the reverse of the input string */ { local(tmp,s,j); tmp = Vec(Str(str)); s=""; forstep(j=length(tmp),1,-1, s=concat(s,tmp[j])); return(s) }
Formula
Let n = d(1)d(2)...d(m) where d(1),d(2),...,d(m) are the digits of n. Then a(n) = m*d1+(m-1)*d2+...+d(m).
Extensions
Changed the description, formula and Pari code Cino Hilliard, Feb 08 2009
More terms to separate from A322001. - R. J. Mathar, Dec 02 2018
Comments