cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A187866 #15 Jan 19 2019 22:18:54
%S A187866 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 A187866 -1,59,97,101,61,89,-1,101,131,127,137,73,133,127,137,119,47,163,101,
%U A187866 157,131
%N 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.
%C A187866 Conjectures:
%C A187866 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 A187866 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 A187866 3. If prime(n) >= 3 there are always at least 2 pairs of twin primes between prime(n) and prime(n)^2.
%H A187866 Pierre CAMI, <a href="/A187866/b187866.txt">Table of n, a(n) for n = 1..25000</a>
%t A187866 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 A187866 (PFGW SCRIPTIFY)
%o A187866 SCRIPT
%o A187866 DIM nn,1
%o A187866 DIM kk
%o A187866 DIMS tt
%o A187866 OPENFILEOUT out,twin
%o A187866 LABEL loopn
%o A187866 SET nn,nn+1
%o A187866 IF nn>25000 THEN END
%o A187866 SET kk,p(nn)
%o A187866 LABEL loopk
%o A187866 SET kk,kk-2
%o A187866 IF kk==-1 THEN GOTO c
%o A187866 SETS tt,%d,%d,%d\,;nn;p(nn);kk
%o A187866 PRP p(nn)*(p(nn)-kk)-1,tt
%o A187866 IF ISPRIME THEN GOTO a
%o A187866 GOTO loopk
%o A187866 LABEL a
%o A187866 PRP p(nn)*(p(nn)-kk)+1,tt
%o A187866 IF ISPRIME THEN GOTO b
%o A187866 GOTO loopk
%o A187866 LABEL b
%o A187866 WRITE out,tt
%o A187866 GOTO loopn
%o A187866 LABEL c
%o A187866 SET kk,-1
%o A187866 SETS tt,%d,%d,%d\,;nn;p(nn);kk
%o A187866 WRITE out,tt
%o A187866 GOTO loopn
%Y A187866 Cf. A187563.
%K A187866 sign
%O A187866 1,7
%A A187866 _Pierre CAMI_, Mar 14 2011