OFFSET
1,7
COMMENTS
Conjectures:
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).
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.
3. If prime(n) >= 3 there are always at least 2 pairs of twin primes between prime(n) and prime(n)^2.
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..25000
MATHEMATICA
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 *)
PROG
(PFGW SCRIPTIFY)
SCRIPT
DIM nn, 1
DIM kk
DIMS tt
OPENFILEOUT out, twin
LABEL loopn
SET nn, nn+1
IF nn>25000 THEN END
SET kk, p(nn)
LABEL loopk
SET kk, kk-2
IF kk==-1 THEN GOTO c
SETS tt, %d, %d, %d\,; nn; p(nn); kk
PRP p(nn)*(p(nn)-kk)-1, tt
IF ISPRIME THEN GOTO a
GOTO loopk
LABEL a
PRP p(nn)*(p(nn)-kk)+1, tt
IF ISPRIME THEN GOTO b
GOTO loopk
LABEL b
WRITE out, tt
GOTO loopn
LABEL c
SET kk, -1
SETS tt, %d, %d, %d\,; nn; p(nn); kk
WRITE out, tt
GOTO loopn
CROSSREFS
KEYWORD
sign
AUTHOR
Pierre CAMI, Mar 14 2011
STATUS
approved