login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #36 Oct 15 2023 18:38:19

%S 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,

%T 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,

%U 5,60,2,59,117,3,63,3,65,5,69,3,69,3,71,140,2,73

%N 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.

%C Will all prime numbers appear in this sequence?

%H Robert Israel, <a href="/A328503/b328503.txt">Table of n, a(n) for n = 1..10000</a>

%e a(7)=20, a(8) = least prime factor of 20 = 2.

%e a(9)=11, a(10) = 11+10 = 21.

%p f:= proc(n) local q; option remember;

%p q:= procname(n-1);

%p if isprime(q) then q+n

%p else min(numtheory:-factorset(q))

%p fi

%p end proc:

%p f(1):= 1: f(2):=3:

%p map(f, [$1..100]); # _Robert Israel_, Oct 25 2019

%t 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 *)

%t 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 *)

%o (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

%Y Cf. A020639, A326935.

%K nonn,look

%O 1,2

%A _Ali Sada_, Oct 22 2019