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
LINKS
Zak Seidov, Table of n, a(n) for n = 1..10000
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
KEYWORD
nonn
AUTHOR
STATUS
approved