login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A185398
a(n) is the number of odd primes p < prime(n)^2 such that prime(n)# - p is prime.
2
0, 1, 6, 9, 15, 14, 21, 24, 22, 43, 38, 50, 54, 43, 61, 62, 74, 66, 79, 81, 87, 94, 93, 99, 101, 101, 110, 114, 119, 123, 129, 136, 160, 150, 184, 158, 178, 196, 171, 176, 180, 190, 201, 202, 222, 221, 230, 252, 242, 244, 251, 235, 261, 262
OFFSET
1,3
COMMENTS
a(n) is not so far from prime(n).
LINKS
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
Cf. A186413.
Sequence in context: A303162 A242042 A316021 * A316022 A316023 A139322
KEYWORD
nonn
AUTHOR
Pierre CAMI, Feb 21 2011
EXTENSIONS
Edited by Charles R Greathouse IV, Feb 21 2011
STATUS
approved