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

A045636 Numbers of the form p^2 + q^2, with p and q primes.

Original entry on oeis.org

8, 13, 18, 29, 34, 50, 53, 58, 74, 98, 125, 130, 146, 170, 173, 178, 194, 218, 242, 290, 293, 298, 314, 338, 365, 370, 386, 410, 458, 482, 530, 533, 538, 554, 578, 650, 698, 722, 818, 845, 850, 866, 890, 962, 965, 970, 986, 1010, 1058, 1082, 1130, 1202, 1250
Offset: 1

Views

Author

Keywords

Comments

A045698(a(n)) > 0. - Reinhard Zumkeller, Jul 29 2012
All terms greater than 8 are of the form 8k+2 or 8k+5 (A047617). - Giuseppe Melfi, Oct 06 2022

Examples

			18 belongs to the sequence because it can be written as 3^2 + 3^2.
		

Crossrefs

A214723 is a subsequence. Complement: A214879.
Cf. A214511 (least number having n orderless representations as p^2 + q^2).
Cf. A047617.

Programs

  • Haskell
    import Data.List (findIndices)
    a045636 n = a045636_list !! (n-1)
    a045636_list = findIndices (> 0) a045698_list
    -- Reinhard Zumkeller, Jul 29 2012
    
  • Mathematica
    q=13; imax=Prime[q]^2; Select[Union[Flatten[Table[Prime[x]^2+Prime[y]^2, {x,q}, {y,x}]]], #<=imax&] (* Vladimir Joseph Stephan Orlovsky, Apr 20 2011 *)
    With[{nn=60},Take[Union[Total/@(Tuples[Prime[Range[nn]],2]^2)],nn]] (* Harvey P. Dale, Jan 04 2014 *)
  • PARI
    list(lim)=my(p1=vector(primepi(sqrt(lim-4)),i,prime(i)^2), t, p2=List()); for(i=1,#p1, for(j=i,#p1, t=p1[i]+p1[j];if(t>lim, break, listput(p2,t)))); vecsort(Vec(p2),,8) \\ Charles R Greathouse IV, Jun 21 2012
    
  • Python
    from sympy import primerange
    def aupto(limit):
        primes = list(primerange(2, int((limit-4)**.5)+2))
        nums = [p*p + q*q for i, p in enumerate(primes) for q in primes[i:]]
        return sorted(set(k for k in nums if k <= limit))
    print(aupto(1251)) # Michael S. Branicky, Aug 13 2021

A045698 Number of ways n can be written as the sum of two squares of primes.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
Offset: 0

Views

Author

Keywords

Comments

a(A214879(n)) = 0; a(A045636(n)) > 0; a(A214723(n)) = 1; a(A214511(n)) = n and a(m) < n for m < A214511(n). - Reinhard Zumkeller, Jul 29 2012
The smallest value of n such that a(n) = 2 is 338. (This helps distinguish it from the characteristic function of A045636.) - Wesley Ivan Hurt, Jun 13 2013

Examples

			For example, a(29) = 1 because 29 = 2^2 + 5^2. a(3) = 0 because there is no way to write 3 as sum of two squares of primes.
		

Crossrefs

Programs

  • Haskell
    a045698 n = length $ filter (\x -> x > 0 && a010051' x == 1) $
    map (a037213 . (n -)) $
    takeWhile (<= div n 2) a001248_list
    -- Reinhard Zumkeller, Jul 29 2012
    
  • PARI
    a(n)=my(s=0,q);forprime(p=2,sqrtint(n\2),if(issquare(n-p^2,&q)&&isprime(q),s++));s \\ Charles R Greathouse IV, Jun 04 2014

Extensions

More terms from Erich Friedman

A283248 Numbers that cannot be represented as a sum of one prime and two primes squared.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 14, 17, 22, 28, 33, 38, 43, 62, 68, 78, 83, 98, 104, 134, 146, 158, 174, 179, 182, 188, 200, 218, 230, 248, 260, 266, 272, 278, 302, 308, 314, 328, 332, 338, 356, 374, 398, 404, 416, 428, 440, 458, 464, 482, 488, 494, 506, 518, 524, 530
Offset: 1

Views

Author

Michel Marcus, Mar 05 2017

Keywords

Examples

			10 is the first missing number since it is 2 + 2^2 + 2^2.
		

Crossrefs

Cf. A214879.

Programs

  • PARI
    isok2(n)=forprime(q=2,sqrtint(n),if(isprimepower(n-q^2)==2, return(0))); 1;
    isok(n) = forprime(p=2, n-1, if (!isok2(n-p), return (0));); 1;
Showing 1-3 of 3 results.