login
Smallest prime p such that p+1 is the product of exactly n distinct prime numbers.
5

%I #20 Mar 17 2023 05:52:43

%S 2,5,29,389,2309,30029,570569,11741729,300690389,10407767369,

%T 239378649509,9426343036109,304250263527209,18740171637257069,

%U 693386350578511589,37508276737897976009,2925030695773453637369,141143645364710083725629,8327475076517894939812169

%N Smallest prime p such that p+1 is the product of exactly n distinct prime numbers.

%H Max Alekseyev, <a href="/A098026/b098026.txt">Table of n, a(n) for n = 1..100</a>

%e a(4) = 389 because 389+1 = 2*3*5*13.

%t Generate[pIndex_, i_] := Module[{p2, t}, p2=pIndex; While[p2[[i]]++; Do[p2[[j]]=p2[[i]]+j-i, {j, i+1, Length[p2]}]; t=Times@@Prime[p2]; t<fact*base, AppendTo[s, t]; If[i<Length[p2], Generate[p2, i+1]]]]; fact=2; Table[pin=Range[n]; base=Times@@Prime[pin]; s={base}; Do[Generate[pin, j], {j, n}]; s=Sort[s]; noPrime=True; i=0; While[noPrime&&i<Length[s], i++; noPrime=!PrimeQ[ -1+s[[i]]]]; If[noPrime, -1, -1+s[[i]]], {n, 20}] (* _T. D. Noe_, Dec 13 2004 *)

%Y Cf. A073918 (least prime p such that p-1 has exactly n distinct prime factors).

%K nonn

%O 1,1

%A _Lekraj Beedassy_, Sep 10 2004

%E Corrected and extended by _Ray Chandler_, Sep 18 2004

%E Further corrected and extended by _T. D. Noe_, Dec 13 2004

%E a(14) corrected and terms a(18) onward added by _Max Alekseyev_, Mar 16 2023