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.

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

This page as a plain text file.
%I A045636 #47 Oct 06 2022 11:50:50
%S A045636 8,13,18,29,34,50,53,58,74,98,125,130,146,170,173,178,194,218,242,290,
%T A045636 293,298,314,338,365,370,386,410,458,482,530,533,538,554,578,650,698,
%U A045636 722,818,845,850,866,890,962,965,970,986,1010,1058,1082,1130,1202,1250
%N A045636 Numbers of the form p^2 + q^2, with p and q primes.
%C A045636 A045698(a(n)) > 0. - _Reinhard Zumkeller_, Jul 29 2012
%C A045636 All terms greater than 8 are of the form 8k+2 or 8k+5 (A047617). - _Giuseppe Melfi_, Oct 06 2022
%H A045636 T. D. Noe, <a href="/A045636/b045636.txt">Table of n, a(n) for n = 1..10000</a>
%H A045636 <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%e A045636 18 belongs to the sequence because it can be written as 3^2 + 3^2.
%t A045636 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 *)
%t A045636 With[{nn=60},Take[Union[Total/@(Tuples[Prime[Range[nn]],2]^2)],nn]] (* _Harvey P. Dale_, Jan 04 2014 *)
%o A045636 (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
%o A045636 (Haskell)
%o A045636 import Data.List (findIndices)
%o A045636 a045636 n = a045636_list !! (n-1)
%o A045636 a045636_list = findIndices (> 0) a045698_list
%o A045636 -- _Reinhard Zumkeller_, Jul 29 2012
%o A045636 (Python)
%o A045636 from sympy import primerange
%o A045636 def aupto(limit):
%o A045636     primes = list(primerange(2, int((limit-4)**.5)+2))
%o A045636     nums = [p*p + q*q for i, p in enumerate(primes) for q in primes[i:]]
%o A045636     return sorted(set(k for k in nums if k <= limit))
%o A045636 print(aupto(1251)) # _Michael S. Branicky_, Aug 13 2021
%Y A045636 A214723 is a subsequence. Complement: A214879.
%Y A045636 Cf. A214511 (least number having n orderless representations as p^2 + q^2).
%Y A045636 Cf. A047617.
%K A045636 nonn,nice
%O A045636 1,1
%A A045636 _Felice Russo_