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.

A152147 Irregular triangle in which row n lists k > 0 such that the sum of digits of k^n equals k.

This page as a plain text file.
%I A152147 #23 May 24 2021 00:47:27
%S A152147 1,2,3,4,5,6,7,8,9,1,9,1,8,17,18,26,27,1,7,22,25,28,36,1,28,35,36,46,
%T A152147 1,18,45,54,64,1,18,27,31,34,43,53,58,68,1,46,54,63,1,54,71,81,1,82,
%U A152147 85,94,97,106,117,1,98,107,108,1,108,1,20,40,86,103,104,106,107,126,134,135
%N A152147 Irregular triangle in which row n lists k > 0 such that the sum of digits of k^n equals k.
%C A152147 Each row begins with 1 and has length A046019(n).
%H A152147 T. D. Noe, <a href="/A152147/b152147.txt">Rows n = 1..1000 of triangle, flattened</a>
%e A152147 1, 2, 3, 4, 5, 6, 7, 8, 9;
%e A152147 1, 9;
%e A152147 1, 8, 17, 18, 26, 27;              (A046459, with 0)
%e A152147 1, 7, 22, 25, 28, 36;              (A055575    "   )
%e A152147 1, 28, 35, 36, 46;                 (A055576    "   )
%e A152147 1, 18, 45, 54, 64;                 (A055577    "   )
%e A152147 1, 18, 27, 31, 34, 43, 53, 58, 68; (A226971    "   )
%e A152147 1, 46, 54, 63;
%e A152147 1, 54, 71, 81,
%e A152147 1, 82, 85, 94, 97, 106, 117,
%e A152147 1, 98, 107, 108, etc.
%o A152147 (Python)
%o A152147 def ok(k, r): return sum(map(int, str(k**r))) == k
%o A152147 def agen(rows, startrow=1, withzero=0):
%o A152147   for r in range(startrow, rows + startrow):
%o A152147     d, lim = 1, 1
%o A152147     while lim < r*9*d: d, lim = d+1, lim*10
%o A152147     yield from [k for k in range(1-withzero, lim+1) if ok(k, r)]
%o A152147 print([an for an in agen(13)]) # _Michael S. Branicky_, May 23 2021
%Y A152147 Cf. A046000, A046017, A046471, A133509.
%K A152147 base,tabf,nonn
%O A152147 1,2
%A A152147 _T. D. Noe_, Nov 26 2008