login
A328503
a(1) = 1; a(n) = the least prime factor of a(n-1) if a(n-1) is a composite number, otherwise a(n) = a(n-1) + n.
1
1, 3, 6, 2, 7, 13, 20, 2, 11, 21, 3, 15, 3, 17, 32, 2, 19, 37, 56, 2, 23, 45, 3, 27, 3, 29, 56, 2, 31, 61, 92, 2, 35, 5, 40, 2, 39, 3, 42, 2, 43, 85, 5, 49, 7, 53, 100, 2, 51, 3, 54, 2, 55, 5, 60, 2, 59, 117, 3, 63, 3, 65, 5, 69, 3, 69, 3, 71, 140, 2, 73
OFFSET
1,2
COMMENTS
Will all prime numbers appear in this sequence?
LINKS
EXAMPLE
a(7)=20, a(8) = least prime factor of 20 = 2.
a(9)=11, a(10) = 11+10 = 21.
MAPLE
f:= proc(n) local q; option remember;
q:= procname(n-1);
if isprime(q) then q+n
else min(numtheory:-factorset(q))
fi
end proc:
f(1):= 1: f(2):=3:
map(f, [$1..100]); # Robert Israel, Oct 25 2019
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[CompositeQ[a[n - 1]], FactorInteger[a[n - 1]][[1, 1]], a[n - 1] + n]; Array[a, 100] (* Amiram Eldar, Oct 23 2019 *)
nxt[{n_, a_}]:={n+1, If[CompositeQ[a], FactorInteger[a][[1, 1]], a+n+1]}; NestList[nxt, {1, 1}, 70] [[;; , 2]] (* Harvey P. Dale, Oct 15 2023 *)
PROG
(PARI) for (n=1, 71, print1 (v=if (n==1, 1, bigomega(f=factor(v))>1, f[1, 1], v+n) ", ")) \\ Rémy Sigrist, Oct 23 2019
CROSSREFS
Sequence in context: A072007 A078783 A273465 * A333826 A125717 A065232
KEYWORD
nonn,look
AUTHOR
Ali Sada, Oct 22 2019
STATUS
approved