OFFSET
0,2
LINKS
Bryan Wolf, Table of n, a(n) for n = 0..13376 (terms < 10^10).
PROG
(Python)
from itertools import count, islice, combinations_with_replacement
def A124095_gen(): # generator of terms
for l in count(1):
for m in combinations_with_replacement('123456789', l):
k = t = int(''.join(m))
while k not in {1, 37, 58, 89, 145, 42, 20, 4, 16}:
k = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(k))
if k == 1:
yield t
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Tanya Khovanova, Nov 25 2006
STATUS
approved