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.

Original entry on oeis.org

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

Views

Author

Cino Hilliard, Feb 05 2009, Feb 07 2009

Keywords

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.

Examples

			For n=19 we have 1*1 + 2*9 = 19, the 14th term in the sequence.
		

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.