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.

A214514 Numbers of the form p^2 + q^2 + r^2, where p, q, and r are primes.

Original entry on oeis.org

12, 17, 22, 27, 33, 38, 43, 54, 57, 59, 62, 67, 75, 78, 83, 99, 102, 107, 123, 129, 134, 139, 147, 150, 155, 171, 174, 177, 179, 182, 187, 195, 198, 203, 219, 222, 227, 243, 246, 251, 267, 291, 294, 297, 299, 302, 307, 315, 318, 323, 339, 342, 347, 363, 369
Offset: 1

Views

Author

T. D. Noe, Jul 29 2012

Keywords

Crossrefs

Cf. A045636 (two primes), A214515 (four primes).

Programs

  • Mathematica
    nn = 10^3; 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 &]; Union[t]
  • Python
    from sympy import primerange as primes
    from itertools import takewhile, combinations_with_replacement as mc
    def aupto(N):
        psqs = list(takewhile(lambda x: x<=N, (p**2 for p in primes(1, N+1))))
        sum3 = set(sum(c) for c in mc(psqs, 3) if sum(c) <= N)
        return sorted(sum3)
    print(aupto(369)) # Michael S. Branicky, Dec 17 2021

A270781 Numbers n with the property that n is both of the form p^2 + q^2 + r^2 + s^2 for some primes p, q, r, and s, and not of the form a^2 + b^2 + c^2 for any integers a, b, and c.

Original entry on oeis.org

31, 47, 63, 71, 79, 87, 92, 103, 111, 124, 127, 143, 151, 156, 159, 175, 183, 188, 191, 199, 207, 220, 223, 231, 247, 252, 255, 271, 295, 303, 311, 316, 319, 327, 343, 348, 351, 367, 383, 391, 399, 412, 415, 423, 439, 444, 463, 471, 476, 487
Offset: 1

Views

Author

Griffin N. Macris, Mar 23 2016

Keywords

Comments

This sequence can easily be shown to be infinite. Take p, q, r equal and congruent to 1 mod 16, and s = 5. Then, because p = 1+16k, n = 28 + 96k + 768k^2, and n = 4*(7+8*m) for m = 3k+24k^2. Then, following from Legendre's three-square theorem, n cannot be written as a^2 + b^2 + c^2 for any a, b, c in the integers. Then, because there are infinitely many primes of the form p = 1+16k, this sequence is infinite.
It appears at first that all Mersenne numbers (A000225) are included in this sequence. However, this is not the case. The first counterexample is 262143 = 2^18 - 1. The next are 4194303 = 2^22 - 1 and 16777215 = 2^24 - 1.

Examples

			31 = 2^2 + 3^2 + 3^2 + 3^2, and, according to Legendre's three-square theorem, 31 cannot be expressed as the sum of three squares, so 31 is a term.
		

Crossrefs

Cf. A000225.
Intersection of A214515 and A004215.
Difference of A214515 and A270783.

Programs

  • Sage
    n=487 #change for more terms
    P=prime_range(1,ceil(sqrt(n)))
    S=cartesian_product_iterator([P,P,P,P])
    A=list(Set([sum(i^2 for i in y) for y in S if sum(i^2 for i in y)<=n]))
    A.sort()
    T=[sum(i^2 for i in y) for y in cartesian_product_iterator([[0..ceil(sqrt(n))],[0..ceil(sqrt(n))],[0..ceil(sqrt(n))]])]
    [x for x in A if not(x in T)] # Tom Edgar, Mar 24 2016

A270783 Numbers of the form p^2 + q^2 + r^2 + s^2 = a^2 + b^2 + c^2 for some primes p, q, r, and s and some integers a, b, and c.

Original entry on oeis.org

16, 21, 26, 36, 37, 42, 52, 58, 61, 66, 68, 76, 82, 84, 100, 106, 108, 116, 132, 133, 138, 148, 154, 164, 172, 178, 180, 181, 186, 196, 202, 204, 212, 226, 228, 236, 244, 250, 260, 268, 276, 292, 298, 300, 301, 306, 308, 322, 324, 332, 340
Offset: 1

Views

Author

Griffin N. Macris, Mar 23 2016

Keywords

Comments

This sequence is infinite since 4p^2 = 0^2 + 0^2 + (2p)^2 is in the sequence for all primes p.
A069262 is a subsequence.
It appears at first that the squares of A139544(n) for n >= 3 are a subsequence. n=22 is the first counterexample, where A139544(22)^2 = 6084 is not an element of this sequence.

Examples

			a(1) = 16 = 2^2 + 2^2 + 2^2 + 2^2 = 0^2 + 0^2 + 4^2.
		

Crossrefs

Difference of A214515 and A270781.
Difference of A214515 and A004215.

Programs

  • Sage
    n=340 #change for more terms
    P=prime_range(1,ceil(sqrt(n)))
    S=cartesian_product_iterator([P,P,P,P])
    A=list(Set([sum(i^2 for i in y) for y in S if sum(i^2 for i in y)<=n]))
    A.sort()
    T=[sum(i^2 for i in y) for y in cartesian_product_iterator([[0..ceil(sqrt(n))],[0..ceil(sqrt(n))],[0..ceil(sqrt(n))]])]
    [x for x in A if x in T] # Tom Edgar, Mar 24 2016
Showing 1-3 of 3 results.