OFFSET
1,1
LINKS
Robert Israel,Table of n, a(n) for n = 1..10000
EXAMPLE
a(3)=2 because 3+2=5 and 3*2+1=7 are prime;
a(8)=5 because 8+5=13 and 8*5+1=41 are prime.
MAPLE
f:= proc(n) local k;
for k from `if`( n::odd, 2, 3) do
if isprime(n*k+1) and isprime(n+k) then return k fi
od
end proc:
map(f, [$1..100]); #Robert Israel,Feb 03 2019
MATHEMATICA
Reap[Do[Do[If[PrimeQ[{n+x, n*x+1}]=={True, True}, Sow[x]; Break[]], {x, 2, 100}], {n, 120}]][[2, 1]]
mnk[n_]:=Module[{k=2}, While[!AllTrue[{n+k, n*k+1}, PrimeQ], k++]; k]; Array[ mnk, 100] (* The program uses the AllTrue function from Mathematica version 10 *) (*Harvey P. Dale,Oct 15 2014 *)
PROG
(PARI) for(n=1, 100, k=2; while(!isprime(n+k), k++; while(!isprime(n*k+1), k++)); print1(k, "," )) \\Jinyuan Wang,Feb 04 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov,Jun 10 2006
STATUS
approved