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!)
A187866 Greatest k such that prime(n)*(prime(n)-k)-1 and prime(n)*(prime(n)-k)+1 are twin primes, k >= 0 and k < prime(n) or -1 if no such k exists. 1

%I #15 Jan 19 2019 22:18:54

%S 0,1,-1,1,-1,-1,11,7,17,17,-1,-1,11,19,41,-1,41,-1,43,53,-1,-1,29,41,

%T -1,59,97,101,61,89,-1,101,131,127,137,73,133,127,137,119,47,163,101,

%U 157,131

%N Greatest k such that prime(n)*(prime(n)-k)-1 and prime(n)*(prime(n)-k)+1 are twin primes, k >= 0 and k < prime(n) or -1 if no such k exists.

%C Conjectures:

%C 1. There are only 11 primes such that k does not exist: 5, 11, 13, 31, 37, 53, 61, 73, 79, 97, 127 (same as A183563).

%C 2. There are only 20 primes such that k(n) = A187563(n): 2, 3, 7, 17, 19, 23, 41, 47, 59, 89, 103, 149, 167, 173, 179, 191, 277, 353, 433, 727.

%C 3. If prime(n) >= 3 there are always at least 2 pairs of twin primes between prime(n) and prime(n)^2.

%H Pierre CAMI, <a href="/A187866/b187866.txt">Table of n, a(n) for n = 1..25000</a>

%t a[n_] := (k=Prime[n]-1; While[p = Prime[n]*(Prime[n]-k)-1; k>=0 && !(PrimeQ[p] && PrimeQ[p + 2]), k--]; k); a /@ Range[45] (* _Jean-Fran├žois Alcover_, Mar 28 2011 *)

%o (PFGW SCRIPTIFY)

%o SCRIPT

%o DIM nn,1

%o DIM kk

%o DIMS tt

%o OPENFILEOUT out,twin

%o LABEL loopn

%o SET nn,nn+1

%o IF nn>25000 THEN END

%o SET kk,p(nn)

%o LABEL loopk

%o SET kk,kk-2

%o IF kk==-1 THEN GOTO c

%o SETS tt,%d,%d,%d\,;nn;p(nn);kk

%o PRP p(nn)*(p(nn)-kk)-1,tt

%o IF ISPRIME THEN GOTO a

%o GOTO loopk

%o LABEL a

%o PRP p(nn)*(p(nn)-kk)+1,tt

%o IF ISPRIME THEN GOTO b

%o GOTO loopk

%o LABEL b

%o WRITE out,tt

%o GOTO loopn

%o LABEL c

%o SET kk,-1

%o SETS tt,%d,%d,%d\,;nn;p(nn);kk

%o WRITE out,tt

%o GOTO loopn

%Y Cf. A187563.

%K sign

%O 1,7

%A _Pierre CAMI_, Mar 14 2011

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 July 21 06:08 EDT 2024. Contains 374463 sequences. (Running on oeis4.)