A045698 Number of ways n can be written as the sum of two squares of primes.
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
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.
Links
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
Comments