cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A156207 Sum of the products of the digits in n and their position m in n.

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