A156207 Sum of the products of the digits in n and their position m in n.
1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 8, 10
Offset: 1
Examples
For n=19 we have 1*1 + 2*9 = 19, the 14th term in the sequence.
Links
- Indranil Ghosh, Table of n, a(n) for n = 1..50000 (terms 1..1000 from Harvey P. Dale)
Programs
-
Maple
A156207 := proc(n) dgs := convert(n,base,10) ; add( op(-i,dgs)*i,i=1..nops(dgs) ); end proc: seq(A156207(n),n=1..97) ; # R. J. Mathar, Sep 07 2016
-
Mathematica
Table[Total[IntegerDigits[n]Range[IntegerLength[n]]],{n,100}] (* Harvey P. Dale, Sep 25 2014 *)
-
PARI
g(n) = v=Vec((Str(n)));sum(x=1,length(v),x*eval(v[x])) g1(nn) = for(j=1,nn,print1(g(j)","))
-
Python
def A156207(n): s=0 for i in range(len(str(n))): s+=(i+1)*int(str(n)[i]) return s # Indranil Ghosh, Feb 11 2017
Formula
Given a number n with m digits d1d2d3...dm, a(n) = d1*1+d2*2+d3*3+...+dm*m.
Comments