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.

A074924 Numbers whose square is the sum of two successive primes.

Original entry on oeis.org

6, 10, 12, 24, 42, 48, 62, 72, 84, 90, 110, 120, 122, 174, 204, 208, 220, 232, 240, 264, 306, 326, 336, 372, 386, 408, 410, 444, 454, 456, 468, 470, 474, 522, 546, 550, 594, 600, 630, 640, 642, 686, 740, 750, 762, 766, 788, 802, 852, 876, 882, 920, 936, 970
Offset: 1

Views

Author

Zak Seidov, Oct 02 2002

Keywords

Examples

			6^2 = 17 + 19, 1610^2 = 1296041 + 1296059.
		

Crossrefs

Square roots of squares in A001043.
Cf. A062703 (the squares), A061275 (lesser of the primes), A064397 (index of that prime).
Cf. A064397 (numbers n such that prime(n) + prime(n+1) is a square), A071220 (prime(n) + prime(n+1) is a cube), A074925 (n^3 is sum of 2 consecutive primes).

Programs

  • Maple
    filter:= proc(n) local t; t:= n^2/2; prevprime(ceil(t)) + nextprime(floor(t)) = n^2 end proc:
    select(filter, [$3..1000]); # Robert Israel, Nov 19 2024
  • Mathematica
    Select[Sqrt[#]&/@(Total/@Partition[Prime[Range[50000]],2,1]),IntegerQ] (* Harvey P. Dale, Oct 04 2014 *)
    f@n_ := Sqrt@Select[(2*Range@n)^2, # == Plus @@ NextPrime[#/2, {-1, 1}] &]; f@485 (* Hans Rudolf Widmer, Nov 19 2024 *)
  • PARI
    is(n)=if(n%2, return(0)); nextprime(n^2/2+1)+precprime(n^2/2)==n^2 \\ Charles R Greathouse IV, Apr 29 2015
    
  • PARI
    select( {is_A074924(n)=!bittest(n=n^2,0) && precprime(n\2)+nextprime(n\/2)==n}, [1..999]) \\ M. F. Hasler, Jan 03 2020
    
  • PARI
    A74924=[6]; apply( A074924(n)={while(n>#A74924, my(N=A74924[#A74924]); until( is_A074924(N+=2),);A74924=concat(A74924,N));A74924[n]}, [1..99]) \\ M. F. Hasler, Jan 03 2020
    
  • Python
    from itertools import count, islice
    from sympy import nextprime, prevprime
    def agen(): # generator of terms
        for k in count(4, step=2):
            kk = k*k
            if prevprime(kk//2+1) + nextprime(kk//2-1) == kk:
                yield k
    print(list(islice(agen(), 54))) # Michael S. Branicky, May 24 2022

Formula

a(n) = sqrt(A062703(n)). - Zak Seidov, May 26 2013
a(n) = A000040(i) + A000040(i+1) with i = A064397(n) = A000720(A061275(n)). - M. F. Hasler, Jan 03 2020

Extensions

Crossrefs section corrected and extended by M. F. Hasler, Jan 03 2020