OFFSET
1,2
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 2+3=5 5>2^2 so a(1)=1
prime(2)#=6 6+5=11,6+7=13 11>3*3 so a(2)=2
PROG
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
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Feb 21 2011
STATUS
approved