OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..60
EXAMPLE
a(3)=111=3*37, so a(4)=3_37=337. 337 is prime, so a(5)=337_1=3371.
MAPLE
a:= proc(n) option remember; `if`(n=0, 0, (t-> parse(cat(`if`(isprime(t) or
t<2, [t, 1][], sort(map(i-> i[1]$i[2], ifactors(t)[2]))[]))))(a(n-1)))
end:
seq(a(n), n=0..21); # Alois P. Heinz, Apr 04 2022
MATHEMATICA
nxt[n_]:=If[n==0||n==1||PrimeQ[n], FromDigits[Join[IntegerDigits[n], {1}]], FromDigits[Flatten[IntegerDigits/@(Table[#[[1]], {#[[2]]}]&/@ FactorInteger[n])]]]; NestList[nxt, 0, 20] (* Harvey P. Dale, May 02 2012 *)
PROG
(Python)
from itertools import count, islice
from sympy import isprime, factorint
def agen():
yield from [0, 1]
an = 11
for n in count(3):
yield an
if isprime(an):
an = 10*an + 1
else:
an = int("".join(str(p) for p in factorint(an, multiple=True)))
print(list(islice(agen(), 21))) # Michael S. Branicky, Apr 04 2022
CROSSREFS
KEYWORD
nonn,easy,base,nice
AUTHOR
Mark Alexiuk (alexiuk(AT)ee.umanitoba.ca)
EXTENSIONS
More terms from Michel ten Voorde Corrected by Harvey P. Dale, Jun 06 2000.
STATUS
approved