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-9 of 9 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

A214512 Least number having n orderless representations as p^2 + q^2 + r^2, where p, q, and r are primes.

Original entry on oeis.org

12, 219, 363, 699, 1179, 2019, 2259, 3891, 4059, 6459, 5379, 10899, 13179, 10659, 12579, 21819, 20979, 26859, 34419, 38379, 41019, 61299, 39459, 41811, 82131, 50379, 77451, 71379, 141099, 85491, 103971, 74571, 180411, 108339, 179739, 161139, 126819, 225099
Offset: 1

Views

Author

T. D. Noe, Jul 29 2012

Keywords

Crossrefs

Programs

  • Mathematica
    nn = 10^6; ps = Prime[Range[PrimePi[Sqrt[nn]]]]; t = Flatten[Table[ps[[i]]^2 + ps[[j]]^2 + ps[[k]]^2, {i, Length[ps]}, {j, i, Length[ps]}, {k, j, Length[ps]}]]; t = Select[t, # <= nn &]; t2 = Sort[Tally[t]]; u = Union[Transpose[t2][[2]]]; d = Complement[Range[u[[-1]]], u]; If[d == {}, nLim = u[[-1]], nLim = d[[1]]-1]; t3 = Table[Select[t2, #[[2]] == n &, 1][[1]], {n, nLim}]; Transpose[t3][[1]]

A214513 Least number having n orderless representations as p^2 + q^2 + r^2 + s^2, where p, q, r, and s are primes.

Original entry on oeis.org

16, 148, 196, 436, 388, 628, 868, 988, 1228, 1468, 1708, 2212, 2068, 2860, 2620, 2380, 3220, 3388, 3700, 4108, 3940, 4180, 5260, 4228, 5068, 4900, 5500, 6220, 6340, 7780, 5908, 5740, 6580, 7540, 8260, 7420, 8860, 9340, 11260, 10708, 9940, 9100, 10180, 12820
Offset: 1

Views

Author

T. D. Noe, Jul 29 2012

Keywords

Crossrefs

Programs

  • Mathematica
    nn = 10^5; ps = Prime[Range[PrimePi[Sqrt[nn]]]]; t = Flatten[Table[ps[[i]]^2 + ps[[j]]^2 + ps[[k]]^2 + ps[[l]]^2, {i, Length[ps]}, {j, i, Length[ps]}, {k, j, Length[ps]}, {l, k, Length[ps]}]]; t = Select[t, # <= nn &]; t2 = Sort[Tally[t]]; u = Union[Transpose[t2][[2]]]; d = Complement[Range[u[[-1]]], u]; If[d == {}, nLim = u[[-1]], nLim = d[[1]]-1]; t3 = Table[Select[t2, #[[2]] == n &, 1][[1]], {n, nLim}]; Transpose[t3][[1]]

A226539 Numbers which are the sum of two squared primes in exactly two ways (ignoring order).

Original entry on oeis.org

338, 410, 578, 650, 890, 1010, 1130, 1490, 1730, 1802, 1898, 1970, 2330, 2378, 2738, 3050, 3170, 3530, 3650, 3842, 3890, 4010, 4658, 4850, 5018, 5090, 5162, 5402, 5450, 5570, 5618, 5690, 5858, 6170, 6410, 6530, 6698, 7010, 7178, 7202, 7250, 7850, 7970, 8090
Offset: 1

Views

Author

Henk Koppelaar, Jun 10 2013

Keywords

Examples

			338 = 7^2 + 17^2 = 13^2 + 13^2;
410 = 7^2 + 19^2 = 11^2 + 17^2.
		

References

  • Stan Wagon, Mathematica in Action, Springer, 2000 (2nd ed.), Ch. 17.5, pp. 375-378.

Crossrefs

Cf. A054735 (restricted to twin primes), A037073, A069496.
Cf. A045636 (sum of two squared primes: a superset).
Cf. A214511 (least number having n representations).
Cf. A226562 (restricted to sums decomposed in exactly three ways).

Programs

  • Maple
    Prime2PairsSum := p -> select(x ->`if`(andmap(isprime, x),true,false), numtheory:-sum2sqr(p)):
    for n from 2 to 10^6 do
      if nops(Prime2PairsSum(n)) = 2 then print(n, Prime2PairsSum(n)) fi;
    od;
  • Mathematica
    Select[Range@10000, Length[Select[ PowersRepresentations[#, 2, 2], And @@ PrimeQ[#] &]] == 2 &] (* Giovanni Resta, Jun 11 2013 *)
  • PARI
    select( is_A226539(n)={#[0|t<-sum2sqr(n),isprime(t[1])&&isprime(t[2])]==2}, [1..10^4]) \\ For more efficiency, apply selection to A045636. See A133388 for sum2sqr(). - M. F. Hasler, Dec 12 2019

Extensions

a(25)-a(44) from Giovanni Resta, Jun 11 2013

A226562 Numbers which are the sum of two squared primes in exactly three ways (ignoring order).

Original entry on oeis.org

2210, 3770, 5330, 6290, 12818, 16490, 18122, 19370, 24050, 24650, 26690, 32810, 33410, 34970, 36530, 39650, 39770, 44642, 45050, 45890, 49010, 50690, 51578, 57770, 59450, 61610, 63050, 66170, 67490, 72410, 73610, 74210, 80330, 85202, 86210, 86330, 88010
Offset: 1

Views

Author

Henk Koppelaar, Jun 11 2013

Keywords

Comments

Suggestion: difference between successive terms is always at least 3. (With the known 115885 terms <10^9, the smallest difference is 24.) - Zak Seidov, Jun 12 2013

Examples

			2210 = 19^2 + 43^2 = 23^2 + 41^2 = 29^2 + 37^2;
		

References

  • Stan Wagon, Mathematica in Action, Springer, 2000 (2nd ed.), Ch. 17.5, pp. 375-378.

Crossrefs

Cf. A054735 (restricted to twin primes), A037073, A069496.
Cf. A045636 (sum of two squared primes), A226539.
Cf. A214511 (least number having n representations).
Cf. A226539 (restricted to sums decomposed in exactly three ways).

Programs

  • Maple
    Prime2PairsSum := s -> select( x -> `if`(andmap(isprime, x), true, false), numtheory:-sum2sqr(s)):
    for n from 2 to 10 do
    if nops(Prime2PairsSum(n)) = 3 then print(n,Prime2PairsSum(n)) fi
    od;
  • Mathematica
    Select[Range@20000, Length[Select[ PowersRepresentations[#, 2, 2], And @@ PrimeQ[#] &]] == 3 &] (* Giovanni Resta, Jun 11 2013 *)

Extensions

a(22)-a(37) from Giovanni Resta, Jun 11 2013

A242230 Primes p of the form p^2 + q + 1 where p < q are consecutive primes.

Original entry on oeis.org

61, 4561, 9511, 17299, 19471, 26737, 30109, 37447, 49957, 69439, 94561, 196699, 209311, 259603, 317539, 333517, 352249, 414097, 427069, 459013, 678157, 845491, 886429, 943819, 1027189, 1217719, 1410163, 1472587, 1647379, 2165323, 2200777, 2230549, 2603389
Offset: 1

Views

Author

K. D. Bajpai, May 08 2014

Keywords

Examples

			a(1) = 61 = 7^2 + 11 + 1: 61 is prime, 7 and 11 are consecutive primes.
a(2) = 4561 = 67^2 + 71 + 1: 4561 is prime, 67 and 71 are consecutive primes.
		

Crossrefs

Programs

  • Maple
    with(numtheory): A242230:= proc()local k ; k:=(ithprime(x)^2+ithprime(x+1)+1); if  isprime(k) then RETURN (k); fi;end: seq(A242230 (),x=1..500);
  • Mathematica
    A242230 = {}; Do[p = Prime[n]^2 + Prime[n + 1] + 1; If[PrimeQ[p], AppendTo[A242230, p]], {n, 500}]; A242230
    Select[#[[1]]^2+#[[2]]+1&/@Partition[Prime[Range[300]],2,1],PrimeQ] (* Harvey P. Dale, Mar 28 2016 *)

A242231 Primes p of the form p^2 + q - 1 where p < q are consecutive primes.

Original entry on oeis.org

13, 31, 59, 307, 383, 557, 997, 1409, 1723, 3541, 5113, 5407, 6323, 6977, 8017, 10303, 19469, 52673, 94559, 109897, 151717, 158009, 187927, 193163, 249503, 274069, 326617, 361807, 383791, 419261, 427067, 546863, 573809, 592133, 636017, 684757, 735307, 738743
Offset: 1

Views

Author

K. D. Bajpai, May 08 2014

Keywords

Examples

			a(1) = 13 = 3^2 + 5 - 1: 13 is prime, 3 and 5 are consecutive primes.
a(2) = 31 = 5^2 + 7 - 1: 31 is prime, 5 and 7 are consecutive primes.
		

Crossrefs

Programs

  • Maple
    with(numtheory): A242231:= proc()local k ; k:=(ithprime(x)^2+ithprime(x+1)-1);if  isprime(k) then RETURN (k); fi;end: seq(A242231 (),x=1..500);
  • Mathematica
    A242231 = {}; Do[p = Prime[n]^2 + Prime[n + 1] - 1; If[PrimeQ[p], AppendTo[A242231, p]], {n, 500}]; A242231
    Select[#[[1]]^2+#[[2]]-1&/@Partition[Prime[Range[250]],2,1],PrimeQ] (* Harvey P. Dale, Mar 05 2022 *)

A226599 Numbers which are the sum of two squared primes in exactly four ways (ignoring order).

Original entry on oeis.org

10370, 10730, 11570, 12410, 13130, 19610, 22490, 25010, 31610, 38090, 38930, 39338, 39962, 40970, 41810, 55250, 55970, 59330, 59930, 69530, 70850, 73730, 76850, 77090, 89570, 98090, 98930, 103298, 118898, 125450, 126290, 130730, 135218, 139490
Offset: 1

Views

Author

Henk Koppelaar, Jun 13 2013

Keywords

Comments

It appears that all first differences are divisible by 24. - Zak Seidov, Jun 14 2013

Examples

			10370 = 13^2 + 101^2 = 31^2 + 97^2 = 59^2 + 83^2 = 71^2 + 73^2.
10730 = 11^2 + 103^2 = 23^2 + 101^2 = 53^2 + 89^2 = 67^2 + 79^2.
		

References

  • Stan Wagon, Mathematica in Action, Springer, 2000 (2nd ed.), Ch. 17.5, pp. 375-378.

Crossrefs

Cf. A054735 (restricted to twin primes), A037073, A069496.
Cf. A045636 (sum of two squared primes is a superset).
Cf. A214511 (least number having n representations).
Cf. A225104 (numbers having at least three representations is a superset).
Cf. A226539, A226562 (sums decomposed in exactly two and three ways).

Programs

  • Maple
    Prime2PairsSum := s -> select(x ->`if`(andmap(isprime, x), true, false),
       numtheory:-sum2sqr(s)):
    for n from 2 to 10^6 do
      if nops(Prime2PairsSum(n)) = 4 then print(n, Prime2PairsSum(n)) fi;
    od;
  • Mathematica
    (* Assuming mod(a(n),24) = 2 *) Reap[ For[ k = 2, k <= 2 + 240000, k = k + 24, pr = Select[ PowersRepresentations[k, 2, 2], PrimeQ[#[[1]]] && PrimeQ[#[[2]]] &]; If[Length[pr] == 4 , Print[k]; Sow[k]]]][[2, 1]] (* Jean-François Alcover, Jun 14 2013 *)

Formula

a(n) = p^2 + q^2; p, q are (not necessarily different) primes
Showing 1-9 of 9 results.