OFFSET
0,2
COMMENTS
a(13) = 8158 * 10^13888887 - 1, per Fox et al., which is too large to include. - Michael S. Branicky, Sep 18 2024
LINKS
N. Bradley Fox et al., Elated Numbers, arXiv:2409.09863 [math.NT], 2024.
PROG
(PARI) f(n) = if (n, my(d=digits(n)); d[1]*norml2(d), 0); \\ A376270
g(n) = my(list=List()); listput(list, n); while(1, my(m=f(n)); if (m==1, return(#list)); if (#select(x->(x==m), Vec(list)), return(0)); listput(list, m); n=m); -1;
a(n) = if (n==0, 1, my(k=2); while(g(k) != n, k++); k);
(Python)
from itertools import count, islice, combinations_with_replacement as mc
def f(n): return (d:=list(map(int, str(n))))[0] * sum(di*di for di in d)
def iters(n):
if n == 1: return 0
traj, c = {n}, 0
while (n:=f(n)) not in traj: traj.add(n); c += 1
return c if 1 in traj else float('inf')
def bgen():
yield from (int(f+"".join(m)) for d in count(1) for f in "123456789" for m in mc("0123456789", d-1))
def agen(): # generator of terms
adict, n = dict(), 0
for k in bgen():
v = iters(k)
if v not in adict:
adict[v] = k
while n in adict: yield adict[v]; n += 1
print(list(islice(agen(), 13))) # Michael S. Branicky, Sep 18 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michel Marcus, Sep 18 2024
STATUS
approved