%I #25 Nov 16 2024 16:56:44
%S 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,
%T 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,
%U 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
%N Sum of the products of the digits in n and their position m in n.
%C 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.
%H Indranil Ghosh, <a href="/A156207/b156207.txt">Table of n, a(n) for n = 1..50000</a> (terms 1..1000 from Harvey P. Dale)
%F Given a number n with m digits d1d2d3...dm, a(n) = d1*1+d2*2+d3*3+...+dm*m.
%e For n=19 we have 1*1 + 2*9 = 19, the 14th term in the sequence.
%p A156207 := proc(n)
%p dgs := convert(n,base,10) ;
%p add( op(-i,dgs)*i,i=1..nops(dgs) );
%p end proc:
%p seq(A156207(n),n=1..97) ; # _R. J. Mathar_, Sep 07 2016
%t Table[Total[IntegerDigits[n]Range[IntegerLength[n]]],{n,100}] (* _Harvey P. Dale_, Sep 25 2014 *)
%o (PARI) g(n) = v=Vec((Str(n)));sum(x=1,length(v),x*eval(v[x]))
%o g1(nn) = for(j=1,nn,print1(g(j)","))
%o (Python)
%o def A156207(n):
%o s=0
%o for i in range(len(str(n))):
%o s+=(i+1)*int(str(n)[i])
%o return s # _Indranil Ghosh_, Feb 11 2017
%K base,nonn,changed
%O 1,2
%A _Cino Hilliard_, Feb 05 2009, Feb 07 2009