%I #41 Sep 08 2022 08:46:09
%S 7,5503,21013,301123,303613,420037,469363,679153,771427,991957,999667,
%T 1524763,1707367,2030653,2333083,2540563,2552713,2710933,3009967,
%U 3378103,3441817,3592213,4419937,4704613,4840723,5177797,5691547,6227587,6275887,6395677,6595597,6597163
%N Primes p such that 4+p, 4+p^2, 4+p^3 and 4+p^5 are all prime.
%C For even k > 2, 4 + n^k is prime only for n = 1.
%C From _Derek Orr_, Aug 28 2014 (edited by _Danny Rorabaugh_, Apr 19 2015): (Start)
%C 4+p^4 is composite for all primes p. For p = 2, 4+p^4 = 20 is composite. To prove it for odd primes, consider S(n) = 4+(2*n+1)^4. S(n) == 0 (mod 5) unless n == 2 (mod 5). If n == 2 (mod 5), then 2*n+1 == 0 (mod 5), which is only prime for n = 2; this gives p = 5 and 4+5^4 = 629 is composite. For other odd primes p, 4+p^4 is greater than 5 and divisible by 5.
%C 4+p^(4*m) is also composite for any prime p and integer m > 0. For each m, the proof is the same as above.
%C (End)
%C All terms are == {3,7} (mod 10). - _Zak Seidov_, Aug 29 2014
%H Charles R Greathouse IV, <a href="/A246519/b246519.txt">Table of n, a(n) for n = 1..10000</a>
%e From _K. D. Bajpai_, Jan 20 2015: (Start)
%e a(2) = 5503:
%e 4 + 5503 = 5507;
%e 4 + 5503^2 = 30283013;
%e 4 + 5503^3 = 166647398531;
%e 4 + 5503^5 = 5046584669419727747;
%e all five are prime.
%e (End)
%t k=4; Select[Prime[Range[1,500000]], PrimeQ[k+#]&&PrimeQ[k+#^2] &&PrimeQ[k+#^3] &&PrimeQ[k+#^5]&] (*_K. D. Bajpai_, Jan 20 2015 *)
%o (PARI) for(n=1, 6000000, if(isprime(n) && isprime(4+n) && isprime(4+n^2) && isprime(4+n^3) && isprime(4+n^5), print1(n, ", "))) \\ _Colin Barker_, Aug 28 2014
%o (PARI) p=7; forprime(q=11, 1e8, if(q-p==4 && isprime(4+p^2) && isprime(4+p^3) && isprime(4+p^5), print1(p, ", ")); p=q) \\ _Charles R Greathouse IV_, Aug 28 2014
%o (Python)
%o from sympy import prime, isprime
%o A246519_list = [p for p in (prime(n) for n in range(1,10**5)) if all([isprime(4+p**z) for z in (1,2,3,5)])]
%o # _Chai Wah Wu_, Sep 08 2014
%o (Magma) [p: p in PrimesUpTo(2*10^7) | IsPrime(4+p) and IsPrime(4+p^2) and IsPrime(4+p^3) and IsPrime(4+p^5)]; // _Vincenzo Librandi_, Apr 19 2015
%Y Cf. A007591, A073573, A125260, A172367.
%Y Primes p such that 4+p^7, 4+p^9 and 4+p^11 are also prime is A253937. - _K. D. Bajpai_, Jan 20 2015
%Y The subsequence with 4+p^7 also prime is A246562. - _Danny Rorabaugh_, Apr 19 2015
%K nonn
%O 1,1
%A _Zak Seidov_, Aug 28 2014