login
A326935
a(1) = 1; a(n) = the largest prime factor of a(n-1) if a(n-1) is a composite number, otherwise a(n)=a(n-1)+n.
2
1, 3, 6, 3, 8, 2, 9, 3, 12, 3, 14, 7, 20, 5, 20, 5, 22, 11, 30, 5, 26, 13, 36, 3, 28, 7, 34, 17, 46, 23, 54, 3, 36, 3, 38, 19, 56, 7, 46, 23, 64, 2, 45, 5, 50, 5, 52, 13, 62, 31, 82, 41, 94, 47, 102, 17, 74, 37, 96, 3, 64, 2, 65, 13, 78, 13, 80, 5, 74, 37
OFFSET
1,2
COMMENTS
Will all prime numbers appear in this sequence?
LINKS
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
Sequence in context: A016661 A376827 A201143 * A135003 A350877 A090895
KEYWORD
nonn,look
AUTHOR
Ali Sada, Oct 22 2019
STATUS
approved