Find all quadruples of positive integers $(p, q, a, b)$, where $p$ and $q$ are prime numbers and $a > 1$, such that $$p^a = 1 + 5q^b.$$
Problem
Source: 2022 JBMO Problem 3
Tags: number theory, prime numbers, Diophantine equation, JBMO
30.06.2022 16:18
$\pmod 2$ tells us that either $p=2$ or $q=2$. i) $p=2$ and $q\ge 3$ $\pmod 5$ gives us $4|a$ so $a\ge 4$ and $a$ is even. We have $5q^b=(2^{\frac a2}-1)(2^{\frac a2}+1)$. Clearly, $q$ cannot divide $2^{\frac a2}-1$ and $2^{\frac a2}+1$ simultaneously. Also, both numbers are greater than $1$ as $a\ge 4$. Hence, one of them is $5$. $2^{\frac a2}-1=5\Rightarrow 2^{\frac a2}=6$, contradiction. $2^{\frac a2}+1=5\Rightarrow 2^{\frac a2}=4\Rightarrow a=4\Rightarrow q^b=2^{\frac a2}-1=3$. Hence, $\boxed{(p,q,a,b)=(2,3,4,1)}$. ii) $q=2$ and $p\ge 3$ If $a$ is odd, then $a\ge 3$ and we have $(p-1)(p^{a-1}+\cdots +p+1)=5\cdot 2^b$. Since $a$ is odd, we know that $p^{a-1}+\cdots +1$ is odd as well. Hence, $5\ge p^{a-1}+\cdots +1\ge p^2+1\ge 10$, contradiction. So $a$ is even. $\pmod 3$ tells us $p=3$. Then $\pmod 5$ tells us $4|a$. We have $5\cdot 2^b=(3^{\frac a2}-1)(3^{\frac a2}+1)$. As $4|a$, we get $2^1|| 3^{\frac a2}+1$ so $3^{\frac a2}+1\in \{2,10\}$. This gives us $p=3, a=4$ and $5\cdot 2^b=80$. So $\boxed{(p,q,a,b)=(3,2,4,4)}$.
30.06.2022 20:10
Its easy to get that $p$ or $q$ must be even Case 1: $p=2$ $\implies 2^a= 1+5q^b \implies 2^a\equiv 1 $(mod 5) $\implies$ $a$ must be even (or more precise $a=4m $ for some $m$) $\implies 2^a\equiv 1$ mod 3 $\implies 5q^b \equiv 0$ mod 3 $\implies q=3$ Now we have that $2^a=1+5\cdot3^b$ For $b\geq2, 2^a\equiv 1 (mod 9)$ and since $ord_{9} 2=6$ we have that $a=6l$ for some $l$ This means that $2^{6l}= 1+5\cdot 3^b$ and because $(2^6)^l\equiv1$ (mod $7$) yields $7\vert 5\cdot3^b$ which is a contadiction This implies that $b=1$ and from there $a=4$ Now we investigate the second case. $p^a-1=5\cdot2^b$ Now from Zsigmondy's theorem there exists some prime divisor of $p^a-1$ that doesn't divide $p-1$ and its easy to see that that prime divisor is $5$.This means that $p$ isn't congruent to $1$ mod $5$ and $p^a\equiv 1$ (mod $5$) And this implies $a=4k$ for some $k$ Now we got that $p^{4k}-1 = 5\cdot2^b$ and if $p\neq 3$, mod $3$ gives contradiction. Now, $p=3$ and $81^{k}-1=5\cdot2^b $ Now by examining the $v_{2}$s on each side and by LTE we get: $4+v_{2}(k)=b$ or $k=2^{b-4}l >2^{b-4}$ So now $5\cdot2^b>81^{2^{b-4}} -1$ Which fails for $b>5$ (simple induction) Now we examine small cases for $b$ and see that only $b=4$ works $\implies k=1$ or $a=4$ and we finished the second case so we are done $QED$
30.06.2022 20:15
This can be solved by Zsigmondy (although that's not a problem for a junior competition). Either $p$ or $q$ is $2$. If $q=2$ and $a>4$, then $p^a-1$ has a new prime factor which doesn't divide $p-1$, $p^2-1$, $p^3-1$, $p^4-1$. However, $5$ must divide one of those $4$ numbers because of orders. Thus, $a \leq 4$. If $a=3$, we have $(p-1)(p^2+p+1)=5 \cdot 2^b$, which implies that $p-1=2^b$ and $p^2+p+1=5$, impossible. If $a=4$, we have that $(p-1)(p+1)(p^2+1)$ is only divisible by $2$ and $5$, but this is impossible as the only common divisor of any pair of those numbers is $2$, so there are at least $3$ distinct prime factors there, unless $p=3$, in which case we get a solution. If $a=2$, either $p-1=2^{b-1}$ and $p+1=5 \cdot 2$, so $b=4$ and $p=9$, impossible, or $p+1=2^{b-1}$, $p-1=10$, which has no solution. Finally, if $q=2$, we have $2^a-1=5 \cdot p^b$. Then $a$ is divisible by $4$, but then $p=3$. However, for $a \geq 8$, there are some new prime factors other than $3$ and $5$ by Zsigmondy, so $a=4$, and this gives us another solution.
30.06.2022 21:31
Proposed by Jason Prodromidis, Greece
01.07.2022 14:00
Another solution without using Zsigmondy.
Attachments:
2022 JBMO P3.docx (18kb)
02.07.2022 19:42
Your solutions are ok but it is more elegant using modulo 317. Modulo 317 yields the solution in two lines.
04.07.2022 16:41
Using VPN is also a solution
05.07.2022 22:18
A curious remark: all cases apart from $q = 2$ with $a$ - odd can be solved using only modular arithmetic! For $p=2$ it is easy, while for $q=2$ and even $a$ one can obtain $p=3$ from mod $3$ and then contradiction for $b\geq 5$ from moduli $32$ and $17$. (So without any factoring you can get 7/10 points lol.)
11.07.2022 04:28
I think my solution's some parts are wrong
13.08.2022 14:42
$(p,q,a,b)=(3,2,4,4)$($follows$ $from$ $mod$ $and$ $parity$)
22.06.2023 01:50
$\pmod 2$ we get that either $p=2$ or $q=2$ 1) $p=2$ $2^a\equiv 1+5q^b\equiv 0\pmod 5 \implies a\equiv 0\pmod 4$ Now we have $(2^{\frac a2}-1)(2^{\frac a2}+1)=5q^b$. $GCD(2^{\frac a2}-1,2^{\frac a2}+1)=1$, thus 5 divides exactly one of the two multiples and one of the multiples is divisible by $q$. One of the multiples is 5 and the other one is $q^b$ because there can't be a multiple equal to one since $2^a-1>1$. $q^b\geq9>5+2$ contradiction because the difference of the multiples is not two. 2) $q=2$ $p^a-1=5\cdot 2^b$ $(p-1)(p^{a-1}+p^{a-2}+p^{a-3}+\cdot \cdot \cdot+p+1)=5\cdot 2^b$ 2.1) $a$ is odd $\implies a\geq3$ and $(p^{a-1}+p^{a-2}+p^{a-3}+\cdot \cdot \cdot+p+1)$ is odd $\implies 5\leq(p^{a-1}+p^{a-2}+p^{a-3}+\cdot \cdot \cdot+p+1)\leq(p^2+p+1)=13$ contradiction 2.2) $a$ is even $(p^{\frac a2}-1)(p^{\frac a2}+1)=5\cdot 2^b$ $GCD(p^{\frac a2}-1,p^{\frac a2}+1)=2$, thus 5 divides exactly one of the two multiples and one of the multiples is divisible by 2 but not 4. One of the multiples is 10 and the other one 2^{b-1} because $p^a-1>2$ 2.2.1)$p^{\frac a2}-1=10$ contradiction $p\notin \mathbb{N}$ 2.2.2)$p^{\frac a2}+1=10 \implies p=3$ and $a=4$ $3^4=1+5\cdot 2^b \implies b=4$ $(a,b,p,q)=(4,4,3,2)$
02.08.2023 15:28
mathmax12's solution (which he told me to share): If we take $\pmod{2}$, we get that either $p$ or $q$ are $2.$ If $p=2$: $2^a=1+5q^b$, taking $\pmod{5}$ gives us that $4|a$, so $5q^b=(2^{\frac{a}{2}}+1)(2^{\frac{a}{2}}-1),$ we have that one of them needs to be divisible by $5$, we get by taking cases that $(2,3,4,1)$ works. If $q=2$: By the same procedure $5\cdot 2^b=(3^{\frac{a}{2}}-1)(3^{\frac{a}{2}}+1)$, now the only solution is $(3,2,4,4).$ In conclusion $\boxed{(3,2,4,4) , (2,3,4,1)}.$
28.10.2023 09:17
Considering the equation in mod $2$, we see that one of $p$ or $q$ must be equal to $2$. Thus, we split the problem into cases Case 1: $p=2$. The equation becomes \[2^a = 1+ 5q^b.\] Taking mod $5$ gives that \[2^a \equiv 1 \pmod{5}\]\[\implies 4 \mid a.\] Setting $a=4x$ gives \[2^{4x}=1+5q^b\]\[\implies (2^{2x}-1)(2^{2x}+1)=5q^b.\] Obviously one of these terms must equal $5$, so we are able to solve that $(p,q,a,b) = (2,3,4,1)$. Case 2: $q=2$. We plug this in to our given equation: \begin{align*} p^a-1 &= 5\cdot2^b \\ (p-1)(p^{a-1}+p^{a-2}+ \dots +1) &= 5\cdot2^b. \end{align*} Now we know that the second part does not equal $5$ and that would imply that $a$ is odd, thus $a$ has to be an even number; $a=2x$. We get \[(p^x-1)(p^x+1)=5\cdot2^b, \] so we again consider two cases: Suppose we have \begin{align*} p^x &=5\cdot2^k+1 \\ p^x &= 2^{b-k}-1 \\ 5\cdot2^k+2 &= 2^{b-k} \\ 5\cdot2^{k-1}+1 &= 2^{b-k-1} \end{align*} Clearly no solutions here. Now let the first parenthesis be $2^{b-k}$, and the second be $5\cdot2^{k}$ for $0\le k\le b.$ \begin{align*} p^x &= 5\cdot2^k-1 \\ p^x &= 2^{b-k}+1, \end{align*} giving $(p,q,a,b)=(3,2,4,4)$. Having exhausted all of the cases, our two answers are $\boxed{(2,3,4,1) \text{ and } (3,2,4,4)}$.
16.11.2023 01:57
Wow, such a nice problem, but i may have overkilled it By taking $\pmod2$ we see that either p or q is equal to $2.$ $\textcolor{red}{CASE}$ $\textcolor{red}{1:}$ $p=2.$ We see that q is an odd number. $2^{a}\equiv 1 \pmod5\implies 4 \mid a$. Say $a=4k$ then taking $\pmod3 \implies q=3.$ The equation becomes $$2^{4k}=16^{k}=1+5.3^{b}.$$From LTE we see that $v_3(k)+1=b,$ thus $k=m.3^{b-1}$ for some integer $m\geq1.$ The equation has become $$16^{(3^{b-1})^{m}}=5.3^{b}+1.$$From the Power-Mean Inequality we have $16\geq(5.3^{b}+1)^{\frac{1}{b}}$ so now we have $$\left(5.3^{b}+1\right)^{\frac{1}{(3^{b-1})^{m}}}\geq(5.3^{b}+1)^{\frac{1}{b}}$$and since $b,m$ are positive integers this inequality only holds when $b,m=1$ meaning the only solution in this case is $\boxed{(p,q,a,b)=(2,3,4,1)}$ $\textcolor{red}{CASE}$ $\textcolor{red}{2:}$ $q=2.$ From $\pmod2$ we understand that p is odd also from $\pmod3$ we see that for $p>3$, p is an odd integer. Since $p^{a}-1=5.2^{b}$, after using Zgimondy's Theorem we see that $2 \mid p-1$ and $p^{a}-1$ has a prime divisor that $p-1$ doesnt have which is obviously 5 meaning that the only prime divisor of $p-1$ is $2.$ From the quadratic residues of $5$, we have $p\neq1,5 \pmod5\implies a=\{0,2\} \pmod5$. Thus a is an even number, and we have a contradiction. This means $p=3$. Now $p^{a}\equiv \pmod 5 \implies 4 \mid a.$ Say $a=4k.$ Using LTE we have $v_2(k)=b-4.$ By factoring we also have $$(9^{k}-1)(9^{k}+1)=5.2^{b}.$$Again using LTE leads us to $v_2(9^{k}-1)=2^{b-1}$ and $v_5(9^k+1)=1$ implies $9^k+1=10\implies k=1$, giving us the only solution in this case as $\boxed{(p,q,a,b)=(3,2,4,4)}$ $\textcolor{blue}{NOTE:}$ We didn't really have to use LTE, Zgimondy's or Power-Mean Inequality in this question, but i thought that this was kinda a cool solution.
01.12.2023 04:35
Problem is a tad bit easy for a #3, all you do is split the parity as follows: If $a\equiv 0\pmod{2}$: If $p\neq{3}$, $p^a\equiv 1\pmod{3}$, forcing $q=3$. Now, $5\cdot{3^b}+1=p^a$. Let $a=2s$, so $p^a-1=(p^s+1)(p^s-1)=5\cdot{3^b}$. Note that both factors cannot simultaneously, since they are 2 apart from each other, and 2 is not a multiple of 3. Therefore, one of the factors is a power of 3, while the other is 5. $p^s-1>1$ unless $s=1, p=2$. Otherwise, $p^s-1=5 \Longrightarrow p^s=6$, or $p^2+1=5 \Longrightarrow p^s=4$. Obviously, only $p=2, s=2$ works after testing these cases, from which $b=1$. We get the quadruple $\boxed{(2, 3, 4, 1)}$. Now we come back to the case $s=1, p=2$, but after plugging it, in none of them produce a factor of 5. Now, we assume $p=3$. Then, $3^a-1=(3^s+1)(3^s-1)=5q^b$. Obviously, $p$ and $q$ must be of opposite parity, so that forces $q=2$. Both factors are even, and assume one of them is in the form $2^k$. The other one will be 2 away from $2^k$ so it does not divide 4 when $k>1$. Thus, one factor must be 10, and the other is $2^k=2^{b-1}$. Obviously, the only possible way to get 10 as a factor is if $s=2$, and this indeed makes the other factor $2^k$ where $k=3$. Since $k=b-1$, $b=4$. We get the quadruple $\boxed{(3, 2, 4, 4)}$. If $a\equiv 1\pmod{2}$: As established, $p$ and $q$ are different parity, so we do subcases on which one is 2. If $p=2$: $2^a\equiv 1\pmod{5} \Longrightarrow a\equiv 0\pmod{4}$ which contradicts the condition in our case. If $q=2$: $p^a-1=(p-1)(p^{a-1}+p^{a-2}\cdots+p+1)$. The second factor with the sum is odd, since there are an odd number of terms and all terms are a power of $p$ which is odd. Therefore, $p-1=2^k$ and $p^{a-1}+p^{a-2}\cdots+p+1=5$. Unfortunately, there are no sequences that satisfy this. Hence, we are done!
30.12.2023 17:26
12.02.2024 20:07
fun problem Notice that one of $p, q$ must be even after fixing both as odd which leads to a contradiction. We split our problem up into two cases. Case 1: $p = 2$: This means that $2^a = 1 + 5q^b$ (and $q$ is odd), which means $2^a \equiv 1\pmod5 \implies 4 \mid a$ looking at residues. Say $a = 4k$. $$2^{4k} = 1 + 5q^b \implies (2^{2k} - 1)(2^{2k} + 1) = 5q^b \implies (2^k - 1)(2^k + 1)(2^{2k} + 1) = 5q^b$$Notice that $3$ divides one of $2^k, 2^k - 1, 2^k + 1$, and since $3 \nmid 2^k$, we have $3 \mid (2^k - 1)(2^k + 1) \implies 3 \mid 5q^b \implies q = 3$. Substitute this back into the equation: $$(2^{2k} - 1)(2^{2k} + 1) = 5\cdot3^b$$Notice that $5 | \; \text{one of} \; (2^{2k} - 1)(2^{2k} + 1) \implies 2^{2k} + 1 = 5 \implies k = 1 \implies a = 4 \implies b = 1$. So our solution set for this case is simply $(4, 1, 2, 3)$. Case 2: $q = 2$: We know $p$ is odd, $p^a = 1 + 5\cdot2^b$. Take $a$ as odd: $$\implies p^a - 1 = (p - 1)(p^{a-1} + ... + p + 1) = 5\cdot2^b$$Since $a$ is odd, the right bracket is also odd, however, $a > 1 \implies p^{a - 1} + ... + 1 \geq p^2 + p + 1 \geq 13 > 5$, which means a contradiction. Therefore, $a$ is even. Say $a = 2k$. $$\implies p^{2k} - 1 = (p^k - 1)(p^k + 1) = 5\cdot2^b$$Notice that $p^k - 1, p^k + 1$ are consecutive evens, which means one only divides 2 while the other divides 4. Therefore, one of them is 10 (since $p^k = 3$, doesn't work). If $p^k - 1 = 10, p^k = 11 \implies p = 11, k = 1$. However $(11 - 1)(11 + 1)$ divides $3$, contradiction. This means $p^k + 1 = 10 \implies p = 3, k = 2 \implies a = 4 \implies b = 4$. This solution set clearly works, hence our two answers are $(4, 1, 2, 3), (4, 4, 3, 2) = (a, b, p, q)$.
03.06.2024 05:22
The two solutions are $(p, q, a, b) = (2, 3, 4, 1)$ and $(3, 2, 4, 4)$. First, suppose $p = 2$; then we have $2^a - 1 = 5q^b$. $2^a \equiv 1 \pmod5$ so $a$ is even. Let $a = 2k$. This gives a difference of squares on the left: $(2^k + 1)(2^k - 1) = 5q^b$. Since the two factors on the LHS are odd numbers which differ by 2, they are relatively prime. Thus $5$ and $q^b$ each divide one of $\{(2^k + 1), (2^k - 1)\}$ and not the other. So the LHS must factor as $5 \cdot q^b$ or $1 \cdot 5q^b$. The first case gives $k = 2$ and $q^b = 3$, yielding the solution $(p, q, a, b) = (2, 3, 4, 1)$. The second case gives no solution. Now suppose $p > 2$. Then $p$ is odd, and checking mod 2 tells us $q^b$ is even, so $q = 2$. We will do casework on the parity of $a$. Suppose $a$ is even. Let $a = 2k$; then we have $(p^k + 1)(p^k - 1) = 5(2^b)$. Note that one of the LHS terms is $2 \pmod4$ and the other is $0 \pmod4$. So $2$ divides one term and $2^{b-1}$ divides the other. Also, $5$ divides exactly one of the terms. Thus the LHS factors as $2 \cdot 5(2^{b-1})$ or $10 \cdot 2^{b-1}$. The first case yields no solutions and the second one forces $p^k = 9$. This gives a solution $(p, q, a, b) = (3, 2, 4, 4)$. Suppose $a$ is odd; let $a = 2k+1$. We have $p^{2k+1} = 1 + 5q^b$. We have $p^{2k+1} \equiv 1 \pmod5$ which implies $p \equiv 1 \pmod5$. Since $p$ is odd, we have $p \equiv 1 \pmod{10}$. Let $p = 10m + 1$. Then: $$(10m+1)^{2k+1} - 1 = 5(2^b)$$$$(10m)((10m+1)^{2k} + (10m+1)^{2k-1} + \dots + (10m+1) + 1) = 5(2^b)$$$$(10m+1)^{2k} + (10m+1)^{2k-1} + \dots + (10m+1) + 1 = 2^{b-1}$$Taking this equation mod 2, we see that $2^{b-1}$ is odd, so $b = 1$. Then $(10m+1)^{2k+1} = 11$ has no valid solution. Therefore $(2, 3, 4, 1)$ and $(3, 2, 4, 4)$ are the only such quadruples. $\blacksquare$
04.06.2024 00:19
Checking the parity, we have $p = 2$ or $q = 2$ $\bullet$ $p = 2$ $2^a \equiv 1 \pmod{5}$ $\Longrightarrow 4 \mid a \Longrightarrow$ $(2^{\frac{a}{2}} - 1)(2^{\frac{a}{2}} + 1) = 5q^b$ so, $2^{\frac{a}{2}} + 1 = 5$ $\Longrightarrow a = 4 \Longrightarrow$ $q=3$ and $b=1$ $\boxed{\therefore (p, q, a, b) = (2, 3, 4, 1)}$ $\bullet$ $q = 2$ If $a$ is odd, notice that: $p^a \equiv 1 \pmod{5\cdot2^b}$ hence, $\begin{cases} ord_{5\cdot2^b}(p) \mid a \\ ord_{5\cdot2^b}(p) \mid \phi(5\cdot2^b) = 2^{b+1} \end{cases}$ $\Longrightarrow ord_{5\cdot2^b}(p) = 1 \Longrightarrow$ $p = (5\cdot2^b)k + 1 \geq$ $5\cdot2^b + 1 = p^a$$ABS!$ thus, $a$ is even and $(p^{\frac{a}{2}} - 1)(p^{\frac{a}{2}} + 1) = 5\cdot2^b$ $\Longrightarrow$ $\begin{cases}p^{\frac{a}{2}} - 1 = 10 & p = 11, a = 2 \\ p^{\frac{a}{2}} + 1 = 10 & p = 3, a = 4\end{cases}$ The first case gives us $2^b = 24 ABS!$, and, the second case gives us $b = 4$ $\boxed{\therefore (p, q, a , b) = (3, 2, 4, 4)}$
06.08.2024 16:04
I may have overkilled this one Taking mod 2, we have either \(p\) or \(q\) even. So, we may split this problem into two cases. Case 1: \(p = 2\) We have \(2^a = 1 + 5q^b\). Since \(2^a \equiv 1 \mod{5}\), \(a \equiv 0 \mod{4} \implies 2^a \equiv 1 \mod{3}\). Therefore, \(3 \mid 5q^b \implies q = 3\). Observe that \(v_3(2^a - 1) = 1 + v_3(a)\). If \(3 \mid a\), we have \(2^a \equiv 1 \mod{7} \implies q = 7\), which is impossible. Therefore, \(v_3(5q^b) = 1 \implies b = 1\). Substituting this back, we have \(a = 4\). So, our solution in this case is \((p, q, a, b) = (2, 3, 4, 1)\) \(\square\) Case 2: \(q = 2\) We have \(1 + 5 \cdot 2^b = p^a\). We shall divide this one into two subcases. Subcase 1: \(b\) is even This implies \(5 \cdot 2^b + 1 \equiv 0 \mod{3} \implies p = 3\), so we have \(1 + 5 \cdot 2^b = 3^a\). \(b = 1\) fails, so \(3^a \equiv 1 \mod{4}\), which means \(a\) is even. The equation rearranges to \(3^a - 1 = 5 \cdot 2^b \implies v_2(3^a - 1) = 2 + v_2(a) = b\), so \(a \geq 2^{b - 2}\). Notice that for \(b \geq 5\), we have \(3^{2^{b - 2}} > 1 + 5 \cdot 2^b\) (induct ). \(b = 2\) fails (it doesn't give a power of 3), and \(b = 4\) gives \(a = 4\). So, another solution is \((p, q, a, b) = (3, 2, 4, 4)\). Subcase 2: \(b\) is odd This means \(1 + 5 \cdot 2^{b} \equiv 2 \mod{3} \implies p \equiv 2 \mod{3}\), \(a \equiv 1 \mod{2}\). Notice that \(p \equiv 1 \mod{2}\), \(p^a \equiv 1 \mod{4} \implies p \equiv 1 \mod{4}\). Assume \(p \equiv 1 \mod{2^k}\) for \(k \leq b - 1\). We claim \(p \equiv 1 \mod{2^{k + 1}}\) as well. Assume that it's not. This means \(p \equiv 2^k + 1 \mod{2^{k + 1}}\). This means \(p^2 \equiv 1 \mod{2^{k + 1}} \implies p^{2x} \equiv 1 \mod{2^{k + 1}} \implies p^{2x + 1} \equiv 2^k + 1 \mod{2^{k + 1}}\), which is a contradiction since \(a\) is odd as well. Therefore, \(p \equiv 1 \mod{2^{k + 1}}\), and \(p \equiv 1 \mod{2^b} \implies p \geq 2^b + 1\). This means \(p^a \geq (2^b + 1)^a\). However, since \(a \geq 3\), we have \((2^b + 1)^a > 5 \cdot (2^b + 1)\) for all \(b\). So, there are no solutions in this case. Therefore, our solutions are only \((p, q, a, b) = (2, 3, 4, 1), (3, 2, 4, 4)\). $\square$
06.01.2025 23:46
$\boxed{ANSWER:(p,q,a,b)=(2,3,4,1)(3,2,4,4)}$ claim 1:$p,q=2$ proof:$p\equiv 1+q\pmod{2}\implies p,q=2$ case 1:$q=2$ $p^{a}=1+5\cdot 2^{b}$ $p^a-1=(p-1)(p^{a-1}+p^{a-2}\cdots+p+1)\implies a=2a_1$ $(p^{a_1}-1)(p^{a_1}+1)=5\cdot 2^b$ case 1.1:$p^{a_1}-1=2\implies p=3,a=2\implies contradiction$ case 1.2:$p^{a_1}+1=10\implies p=3,a=4\implies b=4$ case 2:$p=2$ $2^a=1+5\cdot q^b$ $\pmod{5}\implies a=4a_1$ $(2^{2a_1}-1)(2^{2a_1}+1)=5\cdot q^b$ $gcd=1\implies$ one of them is $5$ case 2.1:$2^{2a_1}-1=5\implies contradiction$ case 2.2:$2^{2a_1}+1=5\implies a=4\implies q=3,b=1$