%I #39 Jun 26 2021 02:17:09
%S 13,37,53,149,151,197,317,353,389,487,557,967,1087,1381,1453,1621,
%T 1693,1709,1861,1877,2207,2237,2293,2837,3181,3541,3607,3847,4517,
%U 4813,5167,5443,5821,6269,6367,6373,6661,6763,6869,6917,7573,7723,7949,8221,9403,9437
%N Primes of the form x^2 + y^3 + 1 where x and y are prime.
%C Terms are primes of the form 1 + A045699(n) for some n.
%C The first term that can be expressed two distinct ways is a(207) = 159079 = 101^2+53^3+1 = 367^2+29^3+1.
%C There are 27 values < 10^8 that can be expressed in two distinct ways.
%H Christian N. K. Anderson, <a href="/A217734/b217734.txt">Table of n, a(n) for n = 1..10000</a>
%e 53 is in the sequence because 53 = 5^2 + 3^3 + 1 and 3, 5, and 53 are all prime numbers.
%o (PARI)
%o isa(n) = {
%o my(r);
%o forprime(x = 1, sqrtint(n),
%o r = n - x ^ 2 - 1;
%o if( ispower(r, 3, &p) && isprime(p),
%o return(1)
%o )
%o );
%o return(0)
%o }
%o select(isa, primes(1200))
%o \\ _Felix Fröhlich_ & _David A. Corneth_ & _Peter Luschny_, Jun 26 2021
%o (Python)
%o from sympy import isprime, primerange
%o def aupto(lim):
%o sq = list(p**2 for p in primerange(1, int(lim**(1/2))+2))
%o cb = list(p**3 for p in primerange(1, int(lim**(1/3))+2))
%o s3 = set(s for s in (a + b + 1 for a in sq for b in cb) if s <= lim)
%o return list(filter(isprime, sorted(s3)))
%o print(aupto(9999)) # _Michael S. Branicky_, Jun 24 2021
%o (SageMath)
%o def aList(sup):
%o P = [p**2 for p in prime_range(1, int(sup**(1/2))+2)]
%o Q = [(p**3 + 1) for p in prime_range(1, int(sup**(1/3))+2)]
%o return sorted([a+b for a in P for b in Q if a+b <= sup and is_prime(a+b)])
%o print(aList(9999)) # _Peter Luschny_, Jun 25 2021
%Y Cf. A045700 (primes of the form p1^2 + p2^3).
%K nonn
%O 1,1
%A _Kevin L. Schwartz_ and _Christian N. K. Anderson_, Mar 22 2013
|