OFFSET
1,3
COMMENTS
a(n) is not so far from prime(n).
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..176
EXAMPLE
prime(1)#=2 , a(n)=0 ( no solution )
prime(2)#=6 , 6-3=3 prime , a(1)=1
prime(3)#=30, 30-7=23,30-11=19,30-13=17,30-17=13,30-19=11,30-23=7
so a(3)=6
PROG
(PFGW Scriptify) SCRIPT
DIM nn, 1
DIM kk
DIM cc
DIM dd
DIMS tt
DIMS ss
OPENFILEOUT myout, res
LABEL loopn
SET nn, nn+1
SET kk, nn
SET cc, 0
SET dd, 0
LABEL loopk
SET kk, kk+1
IF p(kk)>p(nn)^2 THEN GOTO a
SETS tt, %d, %d, %d\,; nn; p(nn); -p(kk)
PRP p(nn)#-p(kk), tt
IF ISPRIME THEN SET cc, cc+1
IF ISPRP THEN SET cc, cc+1
SETS tt, %d, %d, %d\,; nn; p(nn); p(kk)
PRP p(nn)#+p(kk), tt
IF ISPRIME THEN SET dd, dd+1
IF ISPRP THEN SET dd, dd+1
GOTO loopk
LABEL a
SETS ss, %d, %d, %d\,; nn; cc; dd
WRITE myout, ss
GOTO loopn
(PARI) a(n)=my(P=prod(k=1, n, prime(k)), s=0); forprime(p=2, prime(n)^2, s+=ispseudoprime(P-p)); s
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Feb 21 2011
EXTENSIONS
Edited by Charles R Greathouse IV, Feb 21 2011
STATUS
approved