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.

A257768 Numbers m such that for some power k, m is the sum of d + d^k as d runs through the digits of m.

Original entry on oeis.org

12, 18, 30, 90, 666, 870, 960, 1998, 7816, 42648, 119394, 302034, 360522, 1741752, 12051036, 909341082, 931186956, 1136424308, 1145082306, 8390370196, 49388550660, 52927388760, 100552730520, 41845367362266, 51671446297908, 245917854035004, 607628544623816, 858683110606660, 4023730658941192
Offset: 1

Views

Author

Pieter Post, May 07 2015

Keywords

Comments

The power k of most terms in this sequence is equal to or one more or one less than the number of digits in the term. One exception is 302034: 302034 = 3^9 + 0^9 + 2^9 + 0^9 + 3^9 + 4^9 + 3+0+2+0+3+4.

Examples

			666 = (6+6+6) + (6^3 + 6^3 + 6^3).
7816 = (7+8+1+6) + (7^4 + 8^4 + 1^4 + 6^4).
360522 = (3+6+0+5+2+2) + (3^7 + 6^7 + 0^7 + 5^7 + 2^7 + 2^7).
		

Crossrefs

Programs

  • Maple
    mmax:= 10:  # to get all terms < 10^mmax
    Res:= NULL:
    score:= (c,p) -> add(c[i+1]*(i+i^p), i=0..9):
    for m from 2 to mmax do
    comps:= convert(map(`-`,combinat:-composition(10+m,10),[1$10]),list):
    for c in comps do
      cL:= [seq(i$c[i+1], i=0..9)];
      if max(c[3..-1]) = 0 then slim:= 0 else slim:= 10^m fi;
      for p from 1 do
        s:= score(c,p);
        L:= sort(convert(s,base,10));
        if L = cL then Res:= Res,s; break fi;
        if s >= slim then break fi;
      od:
    od:
    od:
    sort([Res]); # Robert Israel, May 08 2015
  • Python
    # WARNING: this prints numbers in the sequence, but not in increasing order.
    def moda(n,a):
        kk = 0
        while n > 0:
            kk= kk+(n%10)**a
            n = n//10
        return kk
    def sod(n):
        kk = 0
        while n > 0:
            kk += n % 10
            n = n//10
        return kk
    for a in range (1, 10):
        for c in range (10, 10**6):
            if c == moda(c,a)+sod(c):
                print(c, end=",")

Extensions

a(14)-a(29) from Giovanni Resta, May 08 2015