login
a(n) is the least prime p such that n*p#-1 is prime.
3

%I #14 Sep 11 2021 06:58:16

%S 3,2,2,2,3,2,2,3,2,2,7,2,5,3,2,2,3,3,2,5,2,2,3,2,3,29,2,3,3,2,2,3,3,2,

%T 5,2,2,3,3,2,5,2,3,3,2,17,3,5,2,5,2,2,3,2,2,13,2,3,3,3,7,13,5,2,3,2,3,

%U 5,2,2,5,3,7,3,2,2,3,3,2,3,13,2,19,2,3,5,2,11,11,2,2,7,3,3,3,2,2,3,2,2,19,7

%N a(n) is the least prime p such that n*p#-1 is prime.

%H Amiram Eldar, <a href="/A119323/b119323.txt">Table of n, a(n) for n = 1..10000</a>

%e 1*(2*3)-1 = 5 is prime, so a(1) = 3 as 3# = 2*3.

%e 2*(2)-1 = 3 is prime, so a(2) = 2 as 2# = 2.

%t a[n_] := Module[{p = pr = 2}, While[!PrimeQ[pr * n - 1], p = NextPrime[p]; pr *= p]; p]; Array[a, 100] (* _Amiram Eldar_, Sep 11 2021 *)

%o (PARI) a(n) = {my(k = 1); while (!isprime(n*prod(j=1, k, prime(j)) - 1), k++); prime(k);} \\ _Michel Marcus_, Sep 14 2019

%Y Cf. A002110 (primorials), A119324.

%K easy,nonn

%O 1,1

%A _Pierre CAMI_, May 14 2006

%E More terms from _David Wasserman_, Jun 20 2007