login
A156207
Sum of the products of the digits in n and their position m in n.
4
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,2
COMMENTS
1,2,3,4,5,6,7,8,9,19 are the only numbers such that a(n) = n. For the case of a 2-digit number, let 10a+b = a+2b. Then 9a = b so a=1 and b = 9.
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..50000 (terms 1..1000 from Harvey P. Dale)
FORMULA
Given a number n with m digits d1d2d3...dm, a(n) = d1*1+d2*2+d3*3+...+dm*m.
EXAMPLE
For n=19 we have 1*1 + 2*9 = 19, the 14th term in the sequence.
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 *)
PROG
(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
CROSSREFS
Sequence in context: A101337 A135208 A259043 * A061486 A264600 A138470
KEYWORD
base,nonn
AUTHOR
Cino Hilliard, Feb 05 2009, Feb 07 2009
STATUS
approved