A035096 a(n) is the smallest k such that prime(n)*k+1 is prime.
1, 2, 2, 4, 2, 4, 6, 10, 2, 2, 10, 4, 2, 4, 6, 2, 12, 6, 4, 8, 4, 4, 2, 2, 4, 6, 6, 6, 10, 2, 4, 2, 6, 4, 8, 6, 10, 4, 14, 2, 2, 6, 2, 4, 18, 4, 10, 12, 24, 12, 2, 2, 6, 2, 6, 6, 8, 6, 4, 2, 6, 2, 4, 6, 6, 26, 6, 10, 6, 10, 14, 2, 6, 4, 12, 12, 24, 6, 8, 4, 2, 10, 2, 4, 10, 2, 8, 30
Offset: 1
Keywords
Examples
a(15)=6 because the 15th prime is 47, and the smallest k such that 47k+1 is prime is k=6, for which 47k+1=283.
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Math, Dirichlet's theorem.
- Index entries for sequences related to primes in arithmetic progressions.
Crossrefs
Programs
-
Magma
S:=[]; k:=1; for n in [1..90] do while not IsPrime(k*NthPrime(n)+1) do k:=k+1; end while; Append(~S, k); k:=1; end for; S; // Bruno Berselli, Apr 18 2013
-
Mathematica
Reap[Sow[1]; Do[p = Prime[n]; k = 2; While[! PrimeQ[k*p + 1], k = k + 2]; Sow[k], {n, 2, 10^4}]][[2, 1]] (* Zak Seidov, Jan 28 2012 *) f[n_] := Block[{p = Prime@ n}, q = 1 + 2p; While[ !PrimeQ@ q, q += 2p]; (q - 1)/p]; f[1] = 1; Array[f, 88] (* Robert G. Wilson v, Dec 27 2014 *)
-
PARI
a(n) = if(n == 1, 1, my(t = 2*prime(n), m = t + 1); while(!isprime(m), m += t); 2*(m - 1)/t); \\ Amiram Eldar, Mar 19 2025
Comments