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.

A214879 Numbers that cannot be written as sum of the squares of two primes.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 29 2012

Keywords

Comments

A045698(a(n)) = 0.

Crossrefs

Cf. A045636 (complement).

Programs

  • Haskell
    import Data.List (elemIndices)
    a214879 n = a214879_list !! (n-1)
    a214879_list = elemIndices 0 a045698_list
    -- Reinhard Zumkeller, Jul 29 2012
    
  • PARI
    is(n)=forprime(p=2,sqrtint(n), if(isprimepower(n-p^2)==2, return(0))); 1 \\ Charles R Greathouse IV, Sep 01 2015
    
  • 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(range(limit+1)) - set(k for k in nums if k <= limit))
    print(aupto(76)) # Michael S. Branicky, Aug 13 2021

Formula

a(n) ~ n. - Charles R Greathouse IV, Sep 01 2015