cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-5 of 5 results.

A161533 The smallest of three consecutive primes p1 < p2 < p3, where p2-p1, p3-p2, and p3-p1 are all perfect squares.

Original entry on oeis.org

623071, 779377, 1744891, 2055853, 2906887, 3168721, 3540793, 4177573, 4245643, 4245679, 4309957, 4449127, 4833271, 4858981, 5541187, 5550583, 5710531, 5710567, 5856931, 6013591, 6789637, 6855493, 7024627, 7162339, 7340383, 7614847, 8143501
Offset: 1

Views

Author

Ki Punches, Jun 13 2009

Keywords

Comments

Note that sqrt(p2-p1), sqrt(p3-p2), sqrt(p3-p1) form a Pythagorean triple. [corrected by James R. Buddenhagen, Jul 09 2013]
Gap pairs p1-p2, p3-p2 occur as 36,64, or 64,36 at least through a(n) <= 10^8.

Examples

			623071 is the smallest of the consecutive primes 623071, 623107, and 623171 with gaps 623107-623071 = 36, 623171-623107 = 64, and the double gap 623171-623071 = 100 each a perfect square.
		

Crossrefs

Programs

  • Mathematica
    PerfectSquareQ[n_] := JacobiSymbol[n, 13] =!= -1 && JacobiSymbol[n, 19] =!= -1 && JacobiSymbol[n, 17] =!= -1 && JacobiSymbol[n, 23] =!= -1 && IntegerQ[Sqrt[n]]; t = {}; n = 2; p1 = 1; p2 = 2; p3 = 3; While[Length[t] < 30, n++; p1 = p2; p2 = p3; p3 = Prime[n]; If[PerfectSquareQ[p2 - p1] && PerfectSquareQ[p3 - p2] && PerfectSquareQ[p3 - p1], AppendTo[t, p1]]]; t (* T. D. Noe, Jul 09 2013 *)
    psQ[{a_,b_,c_}]:=AllTrue[{Sqrt[b-a],Sqrt[c-b],Sqrt[c-a]},IntegerQ]; Transpose[ Select[Partition[ Prime[Range[600000]],3,1],psQ]][[1]] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Aug 20 2014 *)

Extensions

5710567 inserted by R. J. Mathar, Sep 23 2009

A161534 The smallest of four consecutive primes where all three gaps are perfect squares.

Original entry on oeis.org

255763, 604441, 651361, 884497, 913063, 1065133, 1320211, 1526191, 2130133, 2376721, 2907727, 2911933, 2974891, 3190597, 3603583, 3690151, 3707497, 3962941, 4209643, 4245643, 4706101, 5057671, 5155567, 5223187, 5260711, 5321191, 5325571, 5410627
Offset: 1

Views

Author

Ki Punches, Jun 13 2009

Keywords

Comments

Gaps occur as (36,4,36), (4,36,36), etc., all with at least one of them equal to 36 thru primes of 10^9.
A gap of 16 is first involved in 2376721 and 4706101, a gap of 64 first in 4245643, 5710531 and 21953641.
a(26) = 5321191 = A052239(6) = A058252(1) is the first term to be followed by three equal gaps, i.e., to start a sequence of consecutive primes in arithmetic progression (CPAP-4). - M. F. Hasler, Nov 06 2018

Examples

			a(2) = 604441, the smallest of the consecutive primes 604441, 604477, 604481, 604517, with gaps of 36, 4 and 36, all perfect squares.
		

Crossrefs

Programs

  • Mathematica
    PerfectSquareQ[n_] := JacobiSymbol[n, 13] =!= -1 && JacobiSymbol[n, 19] =!= -1 && JacobiSymbol[n, 17] =!= -1 && JacobiSymbol[n, 23] =!= -1 && IntegerQ[Sqrt[n]]; t = {}; n = 3; p1 = 1; p2 = 2; p3 = 3; p4 = 5; While[Length[t] < 30, n++; p1 = p2; p2 = p3; p3 = p4; p4 = Prime[n]; If[PerfectSquareQ[p2 - p1] && PerfectSquareQ[p3 - p2] && PerfectSquareQ[p4 - p3], AppendTo[t, p1]]]; t (* T. D. Noe, Jul 09 2013 *)
    Transpose[Select[Partition[Prime[Range[400000]],4,1],And@@IntegerQ/@ Sqrt[ Differences[#]]&]][[1]] (* Harvey P. Dale, Mar 24 2014 *)

Extensions

Terms beyond a(6) from R. J. Mathar, Sep 23 2009

A118590 Larger of two consecutive primes whose positive difference is a square.

Original entry on oeis.org

3, 11, 17, 23, 41, 47, 71, 83, 101, 107, 113, 131, 167, 197, 227, 233, 281, 311, 317, 353, 383, 401, 443, 461, 467, 491, 503, 617, 647, 677, 743, 761, 773, 827, 857, 863, 881, 887, 911, 941, 971, 1013, 1091, 1097, 1217, 1283, 1301, 1307, 1427, 1433, 1451, 1487
Offset: 1

Views

Author

Cino Hilliard, May 07 2006

Keywords

Examples

			7 and 11 are consecutive primes. 11-7 = 4 a square, so 11 is the second term in the table.
		

Crossrefs

Cf. A031935, A031505, A134117 (gap 6^2), A204670 (gap 8^2), A050434 (gap 10^2), A138198, A161002.

Programs

  • Mathematica
    Select[Table[Prime[n], {n, 2, 237}], IntegerQ[Sqrt[# - Prime[PrimePi[# - 1]]]] &] (* Jayanta Basu, Apr 23 2013 *)
    nn = 500; ps = Prime[Range[nn]]; t = {}; Do[If[IntegerQ[Sqrt[ps[[n]] - ps[[n-1]]]], AppendTo[t, ps[[n]]]], {n, 2, nn}]; t (* T. D. Noe, Apr 23 2013 *)
    Prime[#+1]&/@Flatten[Position[Differences[Prime[Range[250]]],?(IntegerQ[ Sqrt[#]]&)]] (* _Harvey P. Dale, May 08 2019 *)
  • PARI
    g(n) = for(x=2, n, if(issquare(prime(x)-prime(x-1)), print1(prime(x)",")))

Formula

Superset of A031935 and A031505. [From R. J. Mathar, Aug 08 2008]

A338812 Smaller term of a pair of sexy primes (A023201) such that the distance to next pair (A227346) is a square.

Original entry on oeis.org

7, 13, 37, 97, 103, 223, 307, 331, 457, 541, 571, 853, 877, 1087, 1297, 1423, 1483, 1621, 1867, 1993, 2683, 3457, 3511, 3691, 3761, 3847, 4513, 4657, 4783, 4951, 5227, 5521, 5647, 5861, 6337, 6547, 6823, 7481, 7541, 7681, 7717, 7753, 7873, 8287, 8521, 8887, 9007, 9397, 10267, 10453
Offset: 1

Views

Author

Claude H. R. Dequatre, Nov 10 2020

Keywords

Comments

Considering the 10^6 sexy prime pairs from (5,11) to (115539653,115539659), we note the following:
65340 sequence terms (6.5%) are linked to a distance between two consecutive sexy prime pairs which is a square.
List of the 16 classes of distances which are squares: 4,16,36,64,100,144,196,256,324,400,484,576,676,784,900,1024.
The frequency of the distances which are squares decreases when their size increases, with a noticeable higher frequency for the distance 36.
First 20 distances which are squares with in parentheses the subtraction of the smallest members of the related two consecutive sexy prime pairs: 4 (11-7), 4 (17-13),4 (41-37),4 (101-97),4 (107-103),4 (227-223),4 (311-307), 16 (347-331),4 (461-457),16 (557-541),16 (587-571),4 (857-853), 4 (881-877), 4 (1091-1087),4 (1301-1297),4 (1427-1423),4 (1487-1483),36 (1657-1621), 4 (1871-1867),4 (1997-1993).

Examples

			a(2)=13 is in the sequence because the two consecutive sexy prime pairs being (13,19) and (17,23),the distance between them is 17-13=4 which is a square (2^2).
73 is not in the sequence because the two consecutive sexy prime pairs being (73,79) and (83,89),the distance between them is 83-73=10 which is not a square.
		

Crossrefs

Programs

  • Maple
    count:= 0: sp:= 5: R:= NULL:
    p:= sp;
    while count < 100  do
        p:= nextprime(p);
        if isprime(p+6) then
          d:= p - sp;
          if issqr(d) then
            count:= count+1; R:= R, sp;
          fi;
          sp:= p;
        fi;
    od:
    R; # Robert Israel, May 08 2024
  • PARI
    lista(nn) = {my(vs = select(x->(isprime(x) && isprime(x+6)), [1..nn]), vd = vector(#vs-1, k, vs[k+1] - vs[k]), vk = select(issquare, vd, 1)); vector(#vk, k, vs[vk[k]]);} \\ Michel Marcus, Nov 14 2020
  • R
    primes<-generate_n_primes(7000000)
    Matrix_1<-matrix(c(primes),nrow=7000000,ncol=1,byrow=TRUE)
    p1<-c(0)
    p2<-c(0)
    k<-c(0)
    distance<-c(0)
    distance_square<-(0)
    Matrix_2<-cbind(Matrix_1,p1,p2,k,distance,distance_square)
    counter=0
    j=1
    while(j<= 7000000){
      p<-(Matrix_2[j,1])+6
      if(is_prime(p)){
        counter=counter+1
        Matrix_2[counter,2]<-(p-6)
        Matrix_2[counter,3]<-p
      }
      j=j+1
    }
    a_n<-c()
    k=1
    while(k<=1000000){
      Matrix_2[k,4]<-k
      dist<-Matrix_2[k+1,2]-Matrix_2[k,2]
      Matrix_2[k,5]<-dist
      if(sqrt(dist)%%1==0){
        Matrix_2[k,6]<-dist
        a_n<-append(a_n,Matrix_2[k,2])
      }
      k=k+1
    }
    View(Matrix_2)
    View(a_n)
    

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.

Original entry on oeis.org

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

Views

Author

Claude H. R. Dequatre, Nov 23 2020

Keywords

Comments

Considering the 10^6 cousin prime pairs from (3,7) to (252115609,252115613), we note the following:
43617 sequence terms (4.4%) are linked to a distance between two consecutive cousin prime pairs which is a square.
List of the 9 classes of distances which are squares: 4,36,144,324,576,900,1296,1764,2304.
The distance 36 occurs with the highest frequency.
Distances linked to the first 50 terms of the sequence: 4,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,324,144,36,36,36,144,144,144,36,36,36,36,36,36,36,36,144,36,144,36,36,36
From the class 36, the frequency of the distances decreases when their size increases; the distance 4 linked to the first term of the sequence occurs only once.
See for comparison the sequence A338812.

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)
    
Showing 1-5 of 5 results.