OFFSET
1,2
COMMENTS
Will all prime numbers appear in this sequence?
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5)=8, a(6) = largest prime factor of 8 = 2, a(12)=7, a(13)=7+13=20.
MAPLE
f:= proc(n) option remember; local t;
t:= procname(n-1);
if isprime(t) or (t=1) then t+n else max(numtheory:-factorset(t)) fi
end proc:
f(1):= 1:
map(f, [$1..100]); # Robert Israel, Oct 24 2019
MATHEMATICA
nxt[{n_, a_}]:={n+1, If[CompositeQ[a], FactorInteger[a][[-1, 1]], a+n+1]}; NestList[nxt, {1, 1}, 70][[All, 2]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 21 2020 *)
PROG
(Magma) a:=[1, 3]; for n in [3..70] do if not IsPrime(a[n-1]) then Append(~a, Max(PrimeDivisors(a[n-1]))); else Append(~a, a[n-1]+n); end if; end for; a; // Marius A. Burtea, Oct 24 2019
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Ali Sada, Oct 22 2019
STATUS
approved