The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A085063 a(n) is the minimal number k such that n+k and n*k+1 are primes. 7

%I #14 May 15 2018 06:42:15

%S 1,1,2,1,2,1,4,5,2,1,2,1,4,3,2,1,6,1,10,3,2,1,6,13,4,3,4,1,2,1,10,11,

%T 10,3,2,1,4,5,2,1,2,1,4,9,14,1,6,5,4,3,2,1,14,5,6,5,4,1,12,1,6,5,10,3,

%U 2,1,4,15,2,1,8,1,6,27,8,3,6,1,4,3,2,1,6,5,12,11,20,1,12,7,6,5,4,3,2,1,4,5

%N a(n) is the minimal number k such that n+k and n*k+1 are primes.

%C If n+1 is prime then a(n)=1; if n+1 is not prime then a(n)=A120223(n).

%H Robert Israel, <a href="/A085063/b085063.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3)=2 because 3+2=5 and 3*2+1=7 are prime;

%e a(8)=5 because 8+5=13 and 8*5+1=41 are prime,

%p f:= proc(n) local k;

%p for k from 1+(n mod 2) by 2 do

%p if isprime(n+k) and isprime(n*k+1) then return k fi

%p od

%p end proc:

%p f(1):= 1: # _Robert Israel_, May 14 2018

%t Reap[Do[Do[If[PrimeQ[{n+x, n*x+1}]=={True,True},Sow[x];Break[]],{x,1,100}],{n,120}]][[2,1]]

%t nkp[n_]:=Module[{k=1},While[!And@@PrimeQ[{n+k,n*k+1}],k++];k]; Array[nkp, 100] (* _Harvey P. Dale_, Apr 11 2012 *)

%o (PARI) a(n) = {my(k=1); while (!isprime(n+k) || !isprime(n*k+1), k++); k;} \\ _Michel Marcus_, May 14 2018

%Y Cf. A092945, A120223, A120224, A120225.

%K nonn

%O 1,3

%A _Amarnath Murthy_, Jun 28 2003

%E Corrected and extended by _Zak Seidov_, Jun 10 2006

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 18 14:25 EDT 2024. Contains 372630 sequences. (Running on oeis4.)