I searched for primes of the form $p^p+2$, where $p$ is prime for a range of $p \le 10^5$ on PARI/GP and found that 29 is the only prime of this form in this range.


$(1)$ Is $29$ the only prime of the form $p^p+2$, where $p$ is prime?

$(2)$ If not, then are there a finite number of primes of the form $p^p+2$? Can you prove/disprove this?

Edit: Since $p^p$ grows really fast and primes get rarer and are spread farther out for large numbers,

I conjecture that $29$ is the only prime of the form $p^p+2$ where $p$ is a prime.

  • 7
    $\begingroup$ @user0410 $3^3+2=29$ $\endgroup$ – kccu May 8 at 21:06
  • 2
    $\begingroup$ I think (2) is likely. maybe (1) as well, and hard to decide. Primes are rare far out, and $p^p$ grows rapidly. Did the question occur to you for any reason other than random curiousity ? $\endgroup$ – Ethan Bolker May 8 at 21:09
  • 1
    $\begingroup$ @EthanBolker Well I like trying to find rare primes, and since $p^p$ grows rapidly I figured primes like that were rare. But still it would be really nice to prove that 29 is the only prime of this form $\endgroup$ – Mathphile May 8 at 21:14
  • 12
    $\begingroup$ @Mathphile For $p=239$ , there is no small factor. So, there is no easy way to show that $p=3$ is the only soluton, if this is actually the case. Did you really arrive at $p=10^6$ ? The number $p^p+2$ is huge for primes near $10^6$. $\endgroup$ – Peter May 8 at 21:29
  • 3
    $\begingroup$ I would guess that there are only a finite number of primes. There are about a $(p \log^2 p)^{-1}$-fraction of numbers of size roughly $p^p$ that are prime, by the Prime Number Thm. So--making some leaps of logic admittedly--it is tempting to say that the number of primes of this form is something like $\sum_{p} (p \log^2 p)^{-1}$ which is bounded $\endgroup$ – Mike May 8 at 22:09

With pfgw, I checked $$p^p+2$$ for the primes from $\ 3\ $ to $\ 24\ 001\ $ The only prime occured for $\ p=3\ $ Hence if another prime of this form exist, it must have more than $\ 100\ 000\ $ digits

  • 1
    $\begingroup$ What is hardware configuration on which you are able to check primality of 100000 digit numbers? $\endgroup$ – Nilotpal Kanti Sinha May 9 at 8:09
  • 4
    $\begingroup$ The program pfgw is specially designed for testing huge numbers for primality. I used the default trial division. I also doublechecked with factordb. Upto $p=20\ 000$ , no other prime. $\endgroup$ – Peter May 9 at 8:22
  • $\begingroup$ So you ran the program on normal laptop? I mean what was the configuration and runtime? $\endgroup$ – Nilotpal Kanti Sinha May 9 at 8:24
  • 2
    $\begingroup$ On a normal PC. No special hardware. It took several hours however on my slow computer. $\endgroup$ – Peter May 9 at 8:25
  • 1
    $\begingroup$ now with my information linked you might be able to push that into millions. $\endgroup$ – Roddy MacPhee May 9 at 19:24

Some working, but no solution:

Note that $p=2$ doesn't work, and $p=3$ does work. Now suppose $p > 3$.

Suppose $p \equiv 1 \pmod{3}$. Then $p^p + 2 \equiv 1^p + 2 \equiv 0 \pmod{3}$, so it isn't prime.

Therefore, $p \equiv -1 \mod{3}$ and $p$ odd so $p \equiv -1 \mod{6}$. This is as far as I could get. Using WolframAlpha for this case yields numbers that do not have many prime factors, and these factors being distinct and large, so I don't see any way to progress from here.

  • 2
    $\begingroup$ Euler's totient theorem and a larger modulus might help. $\endgroup$ – Roddy MacPhee May 9 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.