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.

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