login
A016014
Least k such that 2*n*k + 1 is a prime.
20
1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 2, 1, 1, 3, 3, 1, 5, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 5, 3, 1, 2, 1, 1, 2, 3, 1, 3, 1, 4, 2, 1, 2, 3, 3, 1, 2, 1, 1, 3, 1, 1, 3, 1, 2, 2, 6, 2, 3, 3, 1, 2, 1, 3, 2, 1, 1, 2, 4, 3, 2, 1, 1, 3, 3, 1, 2, 4, 1, 5, 1, 2, 6, 1, 2, 2, 1, 1, 3, 7, 2, 5, 1, 1, 2, 1, 1
OFFSET
1,4
COMMENTS
Is the sequence bounded? - Zak Seidov, Mar 25 2014
Answer: No, for any given N a number n such that a(n) > N can be constructed by the Chinese Remainder Theorem, see A239727. - Charles R Greathouse IV, Mar 25 2014
a(n) = 1 for n in A005097. - Robert Israel, Oct 26 2016
MAPLE
f:= proc(n) local k;
for k from 1 do if isprime(2*n*k+1) then return k fi od
end proc:
map(f, [$1..100]); # Robert Israel, Oct 26 2016
MATHEMATICA
Do[k = 1; cp = n*k + 1; While[ ! PrimeQ[cp], k++; cp = n*k + 1]; Print[k], {n, 2, 400, 2}] (* Lei Zhou, Feb 23 2005 *)
lk[n_]:=Module[{k=1}, While[!PrimeQ[2n k+1], k++]; k]; Array[lk, 100] (* Harvey P. Dale, Apr 23 2023 *)
PROG
(PARI) a(n)=my(k); while(!isprime(2*n*(k++)+1), ); k \\ Charles R Greathouse IV, Mar 25 2014
(Python)
from sympy import isprime
def a(n):
k = 1
while not isprime(2*n*k + 1): k += 1
return k
print([a(n) for n in range(1, 100)]) # Michael S. Branicky, Mar 28 2022
CROSSREFS
A070846 contains the corresponding primes.
Records are in A239746 with indices in A239727.
Sequence in context: A319135 A338884 A204901 * A067760 A078680 A296072
KEYWORD
nonn
STATUS
approved