A339084 Smaller term p1 of the first of two consecutive cousin prime pairs (p1,p1+4) and (p2,p2+4) such that the distance (p2-p1) is a square.
3, 127, 313, 1447, 2203, 2437, 2797, 3217, 4933, 5653, 6007, 7207, 7537, 7603, 7753, 8233, 10627, 11827, 12373, 20353, 22027, 22153, 23017, 23563, 25303, 27697, 27763, 29023, 29059, 29383, 31477, 32323, 32533, 32569, 32839, 33199, 33577, 35533, 36523, 37273, 41077
Offset: 1
Examples
a(3)=313 is in the sequence because the two consecutive cousin prime pairs being (313,317) and (349,353), the distance between them is 349-313=36 which is a square (6^2). 613 is not in the sequence because the two consecutive cousin prime pairs being (613,617) and (643,647), the distance between them is (643-613)=30 which is not a square.
Crossrefs
Programs
-
PARI
lista(nn) = {my(last=3, p=7); forprime(q=11, nn, if(q-p==4, if (issquare(p-last), print1(last, ", ")); last = p;); p = q;);} \\ Michel Marcus, Nov 23 2020
-
R
Mat<-matrix(0,14000000,5) primes<-generate_n_primes(14000000) Mat[,1]<-c(primes) a_n<-c() Squares<-c() Squares_sq<-c() j=1 counter=0 while(j<=13999999){ if(is_prime((Mat[j,1])+4) & is_prime((Mat[j+1,1]))+4){ counter=counter+1 Mat[counter,2]<-(Mat[j,1]) Mat[counter,3]<-Mat[j,1]+4 Mat[counter+1,2]<-(Mat[j+1,1]) Mat[counter+1,3]<-Mat[j+1,1]+4 } j=j+1 } k=1 while(k<=1000000){ dist<- Mat[k+1,2]-Mat[k,2] Mat[k,4]<-dist if(sqrt(dist)%%1==0){ Mat[k,5]<-dist a_n<-append(a_n,Mat[k,2]) } k=k+1 } View(Mat) View(a_n)
Comments