A103961 Least k such that 2*n*k - 1 is a prime.
2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 4, 3, 1, 1, 2, 2, 1, 2, 1, 1, 3, 1, 3, 2, 1, 3, 3, 1, 1, 2, 2, 1, 2, 1, 1, 2, 3, 1, 2, 1, 3, 3, 1, 4, 3, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 3, 2, 4, 5, 2, 1, 3, 1, 3, 2, 1, 1, 2, 3, 7, 3, 1, 1, 2, 2, 1, 3, 4, 1, 2, 1, 3, 5, 1, 7, 8, 1, 1, 2, 3, 3, 2, 1, 1, 3, 1, 1, 5, 5, 3, 5, 2
Offset: 1
Examples
2*1*2-1 = 3, so a(1) = 2; 2*5*2-1 = 19, so a(5) = 2.
Links
- Dmitry Kamenetsky, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A016014.
Programs
-
Mathematica
Do[k = 1; cp = n*k - 1; While[ ! PrimeQ[cp], k++; cp = n*k - 1]; Print[k], {n, 2, 400, 2}] lkp[n_]:=Module[{k=1},While[!PrimeQ[2n*k-1],k++];k]; Array[lkp,120] (* Harvey P. Dale, Nov 13 2020 *)
-
PARI
a(n) = {my(k=1); while (!isprime(2*n*k-1), k++); k;} \\ Michel Marcus, Oct 27 2016
Comments