Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Well, the question is so:

Suppose P is the set of all primes, p, that satisfy the condition that $8^p+15^p$ is a perfect square.

Find the sum of the elements of P.

Now, over here, I found out a few bits of information. However, I've no idea how to use them, and whether they can even be used.

For example, it should be obvious that 2 belongs to P. As $64+225 = 289 = 17^2$ Also,

$15\equiv -8 \pmod{23}$ So, for all primes greater than 2, (which are obviously odd)

$8^p+ 15^p\equiv 8^p+ (-8)^p\equiv 8^p-8^p \equiv 0 \pmod{23}$

Suppose $8^p+15^p = x^2$, then, $x^2 \equiv 0 \pmod{23}$,

And, as 23 is a prime, this means that, $x \equiv 0 \pmod{23}$ and $x^2 \equiv 0 \pmod{23^2}$.

I also found out that,

$8^p +15^p \equiv 8^{p-(p-1)}+15^{p-(p-1)} \pmod{p}$, by Euler's Theorem.


$x^2\equiv 8^p+15^p \equiv 8+15 \equiv 23 \pmod{p}$.

Hmm. I'd really appreciate it if, instead of giving me a solution flat out, someone could point me in the right direction and perhaps offer a slight push.

Thanks a lot, people.

share|cite|improve this question

Consider what perfect squares are modulo 5 (if you don't know that, work out the possibilities) and then consider the equation $8^p + 15^p$ mod 5. $15^p$ should be easy, and what possibilities are there for $8^p$?

share|cite|improve this answer
Mod 3 is even easier. – EuYu Nov 6 '12 at 18:25
Hey! Thanks a lot for that! I already did the 8^p+15^p mod 5 and mod 3 earlier. I even did mod 10. What was really great was looking at the squares mod 5 and mod 3. Fabulous patterns begin to emerge, even with other modular bases. I'd never have suspected that. I got my answer. 2 is the only prime that works, because the modulars equate only if p is even, which is only possible when p = 2. I even came across excerpts from Gauss' Disquisitiones on similar patterns. Beautiful. – AlpArslan Nov 7 '12 at 9:08

Let $v_p(n)$ denote the maximum prime power in $n$. That is if, $v_p(n)=\alpha\implies p^{\alpha}\mid n$ but $p^{\alpha+1}\nmid n$.

As, $23\mid 8+15$

By Lifting the Exponent Lemma:


For, odd prime $p$, $23\mid 8^p+15^p$ but $23^2\mid 8^p+15^p\iff p=23$.

So, answer $=2+23=25$.

share|cite|improve this answer
This cannot possibly be right $$8^p + 15^p \equiv (-1)^p \pmod3$$ Squares are $0$ or $1$ mod $3$. This necessarily means $2\mid p$ – EuYu Nov 6 '12 at 18:45
Oops! Yes I missed that. – Grobber Nov 7 '12 at 16:33

Note that for any $n$, we have $n^2\equiv 0\pmod3$ or $n^2\equiv 1\pmod3$. (To see it, check for each of the cases $n=3k$, $n=3k+1$, $n=3k-1$.)

Since $3|15$, then $3|15^m$ for all $m>0$, so $3|15^p$ for all (positive) primes $p$, and so $15^p\equiv 0\pmod3$ for any prime $p\in P$. On the other hand, $3$ fails to divide any power of $8$, so $8^p\not\equiv 0\pmod3$ for any prime $p\in P$.

With those observations (and the fact that $2\in P$) in mind, we'll be able to determine precisely what the set $P$ is.

Assume, then that $p\in P$, so that $8^p+15^p=n^2$ for some $n$. We cannot have $n^2=0\pmod3$, for then $8^p\equiv 8^p+15^p\equiv 0\pmod3$, which we already determined to be false. Thus, we must have $n^2\equiv 1\pmod3,$ and so $$8^p\equiv 8^p+15^p\equiv 1\pmod3.\tag{1}$$ Writing $8=9-1$, binomial expansion gives us $$8^p=\sum_{k=0}^p\binom{p}{k}(-1)^k9^{p-k}=(-1)^p+3\sum_{k=0}^{p-1}\binom{p}{k}(-1)^k3^{2p-2k-1},$$ so $8^p\equiv(-1)^p\pmod3,$ and combining this with $(1)$ gives us $$(-1)^p\equiv 1\pmod3.\tag{2}$$ Since $-1\not\equiv 1\pmod3$, then $p$ cannot be odd.

Hence, $P=\{2\}$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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