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-4 of 4 results.

A078667 Integers that occur more than once as the difference of the squares of two consecutive primes.

Original entry on oeis.org

72, 120, 168, 312, 408, 552, 600, 768, 792, 912, 1032, 1848, 2472, 3048, 3192, 3288, 3528, 3720, 4008, 4920, 5160, 5208, 5808, 5928, 6072, 6480, 6792, 6840, 6888, 7080, 7152, 7248, 7512, 7728, 7800, 8520, 8760, 9072, 11400, 11880, 11928, 12792, 13200, 13320
Offset: 1

Views

Author

Jon Perry, Dec 15 2002

Keywords

Comments

1848 is the first integer that occurs exactly three times. The next few are 6888, 14280, 16008, 19152. 4920 is the first integer that occurs exactly four times. See A069482 for more details. - Richard R. Forberg, Feb 06 2015

Examples

			120 = 31^2 - 29^2 = 17^2 - 13^2.
		

Crossrefs

Programs

  • Maple
    N:= 20000: # for terms <= N
    V:= Vector(N):
    p:= 3:
    while 4*(p-1) <= N do
      q:= p; p:= nextprime(p);
      v:= p^2 - q^2;
      if v > N then next fi;
      V[v]:= V[v]+1
    od:
    select(v -> V[v] > 1, 2*[$1..N/2]); # Robert Israel, Aug 22 2025
  • Mathematica
    Sort@ DeleteDuplicates@ Flatten@ Select[Gather[NextPrime[#]^2 - #^2 & /@ Prime@ Range@ 1200], Length@ # > 1 &] (* Michael De Vlieger, Mar 18 2015 *)
    Select[Tally[Differences[Prime[Range[1000]]^2]],#[[2]]>1&][[;;,1]]//Sort (* Harvey P. Dale, Nov 16 2023 *)
  • PARI
    pv(v)=vecsort(vecextract(v,concat("1..",vc-1))) op=2; v=vector(5000); vc=1; forprime (p=3,5000,v[vc]=p^2-op^2; vc++; op=p) v=pv(v) for (i=2,length(v), if (v[i]==v[i-1],print1(v[i]",")))

Extensions

Duplicate terms removed, as suggested by Richard R. Forberg, by Jon E. Schoenfield, Mar 15 2015

A090783 a(n) can be expressed as the difference of the squares of consecutive primes in just three distinct ways.

Original entry on oeis.org

1848, 6888, 14280, 16008, 19152, 36120, 112728, 116832, 129480, 139080, 176520, 190632, 190968, 199752, 216840, 236208, 252120, 274848, 303960, 314160, 340368, 363720, 435792, 458280, 503160, 513240, 686160, 688680, 698880, 712680, 721560
Offset: 1

Views

Author

Ray G. Opao, Feb 08 2004

Keywords

Examples

			1848 = 463^2 - 461^2 = 233^2 - 229^2 = 157^2 - 151^2.
		

Crossrefs

Programs

  • Maple
    N:= 10^6: # to get all terms <= N
    V:= Vector(N/4):
    p:= 3:
    while p < N/2 do
      q:= p;
      p:= nextprime(p);
      r:= (p^2-q^2)/4;
      if r <= N/4 then
        V[r]:= V[r]+1
      fi
    od:
    map(`*`,select(t -> V[t]=3, [$1..N/4]),4); # Robert Israel, Aug 13 2018
  • PARI
    is(n) = my(i=0, v=[]); forprime(p=5, n, v=[precprime(p-1), p]; if(v[2]^2-v[1]^2==n, i++)); i==3 \\ Felix Fröhlich, Aug 13 2018

Extensions

More terms from Ray Chandler, Feb 11 2004

A090785 Numbers that can be expressed as the difference of the squares of consecutive primes in just one way.

Original entry on oeis.org

5, 16, 24, 48, 240, 288, 360, 432, 648, 672, 720, 840, 888, 960, 1080, 1128, 1248, 1320, 1392, 1488, 1560, 1608, 1680, 1728, 1800, 1920, 2040, 2088, 2112, 2232, 2280, 2400, 2520, 2568, 2640, 2808, 2832, 2880, 3120, 3240, 3312, 3360, 3432, 3672, 3912, 4080
Offset: 1

Views

Author

Ray G. Opao, Feb 08 2004

Keywords

Examples

			5 = 3^2 - 2^2.
		

Crossrefs

Programs

  • Python
    from sympy import primerange
    from collections import Counter
    def aupto(limit):
      sqps = [p*p for p in primerange(1, limit//2+1)]
      ways = Counter(sqps[i+1]-sqps[i] for i in range(len(sqps)-1))
      return sorted(k for k in ways if k <= limit and ways[k] == 1)
    print(aupto(4080)) # Michael S. Branicky, May 16 2021

Extensions

More terms from Ray Chandler, Feb 11 2004

A091878 a(n) can be expressed as the difference of the squares of consecutive primes in just four distinct ways.

Original entry on oeis.org

4920, 801528, 1484280, 5351640, 7257720, 7647360, 12168912, 12302472, 15540360, 17348520, 21623160, 25639320, 27285048, 27462840, 27470352, 34714680, 35684040, 38466288, 48449640, 49936152, 51272760, 54037368, 60948888
Offset: 1

Views

Author

Ray G. Opao and Ray Chandler, Feb 11 2004

Keywords

Examples

			4920=211^2-199^2=251^2-241^2=617^2-613^2=1231^2-1229^2
		

Crossrefs

Programs

  • C
    #define NMAX 200000000 #include  #include  #include  int isprime(const int n) { for(int i=2 ; i*i <= n ; i++) if( n % i == 0) return(0) ; return 1 ; } int main(int argc, char *argv[]) { short * n= (short*)calloc(NMAX,sizeof(short)) ; int wm=0; for(int p=2 ; ; ) { int np=p+1 ; while( !isprime(np) ) np++ ; if(np<0) break ; if ( p+np < INT_MAX/(np-p) ) { const int i=(p+np)*(np-p) ; const int nw= p+np ; if( i < NMAX ) n[i]++ ; for(int j=wm ; j < nw ; j++) if ( n[j] == 4) printf("%d ",j) ; wm=nw ; } p=np ; if( p > INT_MAX-np ) break ; } free(n) ; } - R. J. Mathar, Oct 05 2006

Extensions

More terms from R. J. Mathar, Oct 05 2006
Showing 1-4 of 4 results.