Find the sum of all primes q < 1 0 0 0 such that for some prime p < q , both q divides p 3 − 1 and p divides q 3 − 1 .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The Vieta Jumping is one of the names for the recursive technique used to solve the second case, for not necessarily prime p and q. All correct solutions used it, usually without the name.
The incorrect solutions involved brute-force analysis, using a computer or a table of primes. Such solutions may give the correct numerical answer, but are, by their nature, impossible to check mathematically, thus are not valid.
First, we note that p 3 − 1 = ( p − 1 ) ( p 2 + p + 1 ) , so q ∣ p 3 − 1 ⇒ q ∣ p − 1 or q ∣ p 2 + p + 1 . But q > p > p − 1 , so q ∤ p − 1 . So q ∣ p 2 + p + 1 . Similarly, p ∣ q 3 − 1 ⇒ p ∣ q − 1 or p ∣ q 2 + q + 1 . So we will need to consider two cases: p ∣ q − 1 and p ∣ q 2 + q + 1 .
Case 1: p ∣ q − 1
Let q − 1 = a p . Then q = a p + 1 . Since q > p , then a ≥ 1 . Also since q ∣ p 2 + p + 1 , we can let p 2 + p + 1 = k q for some positive integer k ( k is clearly non-zero). Express k in the form b p + c , where b , c are non-negative integers with 0 ≤ c < p . Then p 2 + p + 1 = ( b p + c ) ( a p + 1 ) . Taking modulo p , we easily see that c ≡ 1 ( m o d p ) , so c = 1 . Thus, p 2 + p + 1 = ( b p + 1 ) ( a p + 1 ) . If b ≥ 1 , then p 2 + p + 1 ≥ ( p + 1 ) ( p + 1 ) = p 2 + 2 p + 1 , which is clearly false. So b = 0 . Therefore, p 2 + p + 1 = ( 0 p + 1 ) ( a p + 1 ) = a p + 1 = q . Indeed, if q = p 2 + p + 1 , then p ∣ q − 1 (and hence p ∣ q 3 − 1 ) and q ∣ p 2 + p + 1 (and hence q ∣ p 3 − 1 ). So we just need to find all primes q of the form p 2 + p + 1 (where p is prime) below 1 0 0 0 . Since q < 1 0 0 0 , p < 1 0 0 0 < 3 2 . The possible p are 2 , 3 , 5 , 7 , 1 1 , 1 3 , 1 7 , 1 9 , 2 3 , 2 9 and 3 1 . If p ≡ 1 ( m o d 3 ) , then q ≡ 1 2 + 1 + 1 ≡ 0 ( m o d 3 ) is not prime (note that q > 3 since 2 2 + 2 + 1 > 3 ). So we only need to check p = 2 , 3 , 5 , 1 1 , 1 7 , 2 3 and 2 9 . The corresponding q are 7 , 1 3 , 3 1 , 1 3 3 , 3 0 7 , 5 5 3 and 8 7 1 . The only primes among these are 7 , 1 3 , 3 1 and 3 0 7 ( 1 3 3 and 5 5 3 are divisible by 7 ; 8 7 1 is divisible by 1 3 ), so the only pairs of ( p , q ) are ( 2 , 7 ) , ( 3 , 1 3 ) , ( 5 , 3 1 ) and ( 1 7 , 3 0 7 ) .
Case 2: p ∣ q 2 + q + 1
Instead of primes p , q , we first consider generally two integers s , t , where 1 ≤ s ≤ t , such that t ∣ s 2 + s + 1 and s ∣ t 2 + t + 1 . Note that s = p and t = q is subsumed under this general definition. Let t r = s 2 + s + 1 for some positive integer r ( r is clearly non-zero). Clearly, g c d ( s , t ) ∣ t r − s 2 − s ⇒ g c d ( s , t ) ∣ 1 ⇒ g c d ( s , t ) = 1 . Since t r ≡ 1 ( m o d s ) , then t 2 ( r 2 + r + 1 ) ≡ ( t r ) 2 + t ( t r ) + t 2 ≡ 1 + t + t 2 ≡ 0 ( m o d s ) . Since g c d ( s , t ) = 1 , then we can deduce that r 2 + r + 1 ≡ 0 ( m o d s ) , i.e. s ∣ r 2 + r + 1 . Thus, if t ∣ s 2 + s + 1 and s ∣ t 2 + t + 1 , then s ∣ r 2 + r + 1 and r ∣ s 2 + s + 1 (remember that t r = s 2 + s + 1 ). This means that from any pair of integers ( s , t ) satisfying t ∣ s 2 + s + 1 and s ∣ t 2 + t + 1 , we can generate another pair of integers ( r , s ) satisfying s ∣ r 2 + r + 1 and r ∣ s 2 + s + 1 . In particular, we can call ( r , s ) the descendant of ( s , t ) if r ≤ s .
If t = s , then r = s s 2 + s + 1 = s + 1 + s 1 . Since r is an integer, then s = 1 . But this means that r = 3 > s , so ( 1 , 1 ) does not have any descendants. If t = s + 1 , then r = s + 1 s 2 + s + 1 = s + s + 1 1 which obviously cannot be an integer. If t ≥ s + 2 , then r = t s 2 + s + 1 ≤ s + 2 s 2 + s + 1 = s − s + 2 s − 1 ≤ s since s − 1 ≥ 0 . So ( r , s ) is a descendant of ( s , t ) in this case. Also, since g c d ( s , t ) = 1 , then s = t if ( s , t ) = ( 1 , 1 ) . Thus, with the exception of ( 1 , 1 ) , we have s < t and r ≤ s , so s + t > r + s , i.e. the sum of the pair of numbers in the ancestor will be greater than that in its descendant. This is important because it means that for any pair ( s , t ) such that 1 ≤ s ≤ t , t ∣ s 2 + s + 1 and s ∣ t 2 + t + 1 , it is possible to generate its chain of descendants (with decreasing sum of the pair of numbers) till we reach ( 1 , 1 ) .
We have proven that each pair ( s , t ) (satisfying 1 ≤ s ≤ t , t ∣ s 2 + s + 1 and s ∣ t 2 + t + 1 ), with the exception of ( 1 , 1 ) , has exactly one descendant ( t s 2 + s + 1 , s ) . Now we suppose a descendant ( r , s ) of an ancestor ( s , t ) has another ancestor ( s , T ) . Then we have T s 2 + s + 1 = t s 2 + s + 1 , so we can easily see that T = t . Thus, each pair ( r , s ) (satisfying 1 ≤ r ≤ s , s ∣ t 2 + t + 1 and r ∣ s 2 + s + 1 ) has exactly one ancestor as well. Specifically, this ancestor is ( s , r s 2 + s + 1 ) . This is important because it means that from any pair ( r , s ) such that 1 ≤ r ≤ s , s ∣ t 2 + t + 1 and r ∣ s 2 + s + 1 , we can re-construct its unique ancestor, which is ( s , r s 2 + s + 1 ) .
Now, it is possible to list all the ( s , t ) satisfying 1 ≤ s ≤ t , t ∣ s 2 + s + 1 and s ∣ t 2 + t + 1 using the ancestor-descendant relationships and starting from the descendant ( 1 , 1 ) . In particular, we are only looking at the pairs ( s , t ) where both s and t are prime and where t < 1 0 0 0 . Since the pairs will only get larger and larger, we can stop when the larger number of the pair exceeds 1 0 0 0 . The pairs are: ( 1 , 1 ) , ( 1 , 3 ) , ( 3 , 1 3 ) , ( 1 3 , 6 1 ) , ( 6 1 , 2 9 1 ) and ( 2 9 1 , 1 3 9 3 ) . Since 1 and 2 9 1 = 3 ⋅ 9 7 are not primes, then the only valid pairs ( p , q ) are ( 3 , 1 3 ) and ( 1 3 , 6 1 ) .
Combining the results we have for both cases, we have ( p , q ) = ( 2 , 7 ) , ( 3 , 1 3 ) , ( 5 , 3 1 ) , ( 1 3 , 6 1 ) and ( 1 7 , 3 0 7 ) . The sum of all q is thus 7 + 1 3 + 3 1 + 6 1 + 3 0 7 = 4 1 9 .
If p = 2 , then the only possible q is q = 7 , so we will consider this solution and from now on take p , q as odd primes.
q ∣ ( p − 1 ) ( p 2 + p + 1 ) . Since they are primes, and q > p , it follows that q ∣ p 2 + p + 1 , or k q = p 2 + p + 1 , where k is an integer, and also is relatively prime with p . Now we have 2 cases:
First case: p ∣ q − 1 . Substituting for q , we get p ∣ k p 2 + p + 1 − 1 now, because ( k , p ) = 1 , it follows that p ∣ 1 − k . The only solution is k = 1 . Substituting in the other equation gives: q = p 2 + p + 1 . We test all small primes p, and see that only for p ∈ 3 , 5 , 1 7 , p 2 + p + 1 is also a prime, so q ∈ 1 3 , 3 1 , 3 0 7
[Note: This solution doesn't justify why we cannot have k = p + 1 , 2 p + 1 , … This follows from observing that since q ≥ p + 1 , thus k = q p 2 + p + 1 < p + 1 , which is hinted at in the second case. -Calvin]
Second case:
p
∣
q
2
+
q
+
1
. Lets omit the fact that they must be primes, just consider them as odd integers, find all solutions, and then check for the primes.
k
2
+
k
+
1
=
(
q
p
2
+
p
+
1
)
2
+
q
p
2
+
p
+
1
+
1
≡
q
2
q
2
+
q
+
1
≡
0
(
m
o
d
p
)
. If
p
>
2
it follows that:
k
=
q
p
2
+
p
+
1
≤
p
+
2
p
2
+
p
+
1
=
p
−
1
+
p
+
2
4
<
p
. From the last
2
statements it follows that if
(
p
,
q
)
is a solution to the system, with
q
>
p
>
2
, then
(
q
p
2
+
p
+
1
,
p
)
is a smaller solution. Reducing the solutions this way, they will all trace to the solution with
p
=
1
, that is
(
1
,
3
)
. So we can start from
(
1
,
3
)
and increase the solution to get the pairs:
(
1
,
3
)
,
(
3
,
1
3
)
,
(
1
3
,
6
1
)
,
(
6
1
,
2
9
1
)
,
(
2
9
1
,
1
3
9
3
)
,
…
. The first one does not contain only primes, we already have the 2nd solution, the third solution is primes, the fourth is not a prime since 291 is a multiple of 3, and the rest will yield
q
>
1
0
0
0
.
So the solutions are: 7 , 1 3 , 3 1 , 3 0 7 , 6 1 .
This question was made harder because we only wanted prime solutions, while the solution actually solves it over the integers (case 2). Most students were unable to find the solution set ( 1 3 , 6 1 ) which arose only in case 2.
Common mistakes.
Claiming that if p ∣ 1 − k then we must have k = 1 . This is not true, as the values can be negative integers. For example, 5 ∣ − 1 0 .
Assuming that p ≤ 3 1 'because' otherwise p 2 + p + 1 = q contradicts q < 1 0 0 0 .
Merely listing out sets which satisfy the conditions, without explaining why this is all the possible sets.
We will solve this by finding the two families of solutions to p ∣ q 3 − 1 and q ∣ p 3 − 1 .
Suppose we have a solution. Then q ∣ ( p − 1 ) ( p 2 + p + 1 ) . But q ∤ ( p − 1 ) since q > p , so q ∣ p 2 + p + 1 .
Our two families will arise from p ∣ q − 1 and p ∣ q 2 + q + 1 respectively.
Case 1: p ∣ q − 1
We will show that, in this case, q = p 2 + p + 1 . Indeed, suppose not; then q r = p 2 + p + 1 for some r . But q is 1 mod p , and so is the RHS, hence r is. But that means that q and r are both at least p + 1 , so q r ≥ p 2 + 2 p + 1 , contradiction.
This is one family; ( p , q ) such that q = p 2 + p + 1 . It is easy to see that this works, provided that both p and q are prime.
For the solutions with q ≤ 1 0 0 0 , we need simply check all primes p ≤ 3 2 . This is not a difficult check, and results in the list (2,3,5,17) for p , and (7,13,31,307) correspondingly for q .
Case 2: p ∣ q 2 + q + 1
Let us instead consider positive integer solutions to x ∣ y 2 + y + 1 and y ∣ x 2 + x + 1 . We will find that solutions to the original relation correspond to solutions to this one, where x and y are both prime. Let z = x y 2 + y + 1 . Note that by the first relation, z is an integer and z ∣ y 2 + y + 1 .
Also, working modulo y , z = x 1 , and so z is the other root to the equation t 2 + t + 1 ≡ 0 mod y . Hence, if ( x , y ) solved the relation, then so will ( z , y ) .
I claim that all solutions are a pair of consecutive terms in the sequence 1,1,3,13,61,291,... (clearly all further terms are greater than 1000), where u n − 1 u n + 1 = u n 2 + u n + 1 . Indeed, suppose we have a solution outside that sequence, ( x , y ) , with x ≥ y . Take the solution with smallest x + y . If x = y , then it is easy to see that they must both equal 1, contradiction (as (1,1) is in the sequence). Otherwise, z , y is a solution (from above), but with smaller sum, contradiction.
Hence, all solutions are pairs of consecutive terms in that sequence which are both prime. But the only such pairs with q ≤ 1 0 0 0 are (3,13) and (13,61), introducing a fifth solution, as we’ve already found (3,13).
Hence, q ∈ { 7 , 1 3 , 3 1 , 6 1 , 3 0 7 } , with sum 419.
Because p < q , q cannot divide p − 1 , so q ∣ p 2 + p + 1 . For p ∣ q 3 − 1 two cases exist.
Case 1. p ∣ q − 1 . Suppose q = p k + 1 . Because q ∣ p 2 + p + 1 , we have
q ∣ p 2 k + p k + k = p ( p k + 1 ) + p k − p + k = p ( p k + 1 ) + ( p k + 1 ) + k − p − 1
So, q = p k + 1 must divide k − p + 1 . Because q ≤ p 2 + p + 1 , k ≤ p p 2 + p , so k ≤ p + 1 . On the other hand, k ≥ 1 , so k − p − 1 ≥ − p > − q . So the only way q could divide k − p − 1 is if k − p − 1 = 0 . This implies that q = p 2 + p + 1 .
If p = 2 , then q = 7 . If p = 3 , then q = 1 3 . If p > 3 , one can easily check that if p ≡ 1 ( m o d 6 ) , then q ≡ 1 + 1 + 1 = 3 ( m o d 6 ) , so we must have p ≡ 5 ( m o d 6 ) . We get pairs ( p , q ) = ( 5 , 3 1 ) , ( 1 7 , 3 0 7 ) . Note that for p = 1 1 and p = 2 3 the number p 2 + p + 1 is divisible by 7 ; for p = 2 9 it is divisible by 1 3 (by easy calculations modulo the corresponding primes). For all other p , p ≥ 3 5 so the number p 2 + p + 1 is greater than 1 0 0 0 .
Case 2. p ∣ q 2 + q + 1 . In this case, we consider a more general problem: find all pairs of positive integers n < m , not necessarily prime, such that n ∣ m 2 + m + 1 and m ∣ n 2 + n + 1 . One can check that such n and m must be coprime. If n 2 + n + 1 = m k , then obviously k ∣ n 2 + n + 1 and, a little less obviously, n ∣ k 2 + k + 1 (because k ≡ m 1 ( m o d n ) and m 2 + m + 1 ≡ 0 ( m o d n ) ).
Simple inequalities show that, unless ( n , m ) = ( 1 , 3 ) , k < n . So any pair ( n , m ) can be reduced to ( 1 , 3 ) . Backtracking, we get the following sequence of pairs ( n , m ) : ( 1 , 3 ) → ( 3 , 1 3 ) → ( 1 3 , 6 1 ) → ( 6 1 , 2 9 1 ) → ( 2 9 1 , 1 3 9 3 ) → . . . Out of these, ( 1 3 , 6 1 ) is a pair of primes, not considered before, and 2 9 1 is divisible by 3 .
Putting this all together, we get five possible prime pairs: ( 2 , 7 ) , ( 3 , 1 3 ) , ( 5 , 3 1 ) , ( 1 3 , 6 1 ) , ( 1 7 , 3 0 7 ) So the answer is 7 + 1 3 + 3 1 + 6 1 + 3 0 7 = 4 1 9 .
int main()
{
int a,b,count=0,flag,c[1000];
for (a=2;a<1000;a++)
{
flag=0;
for (b=2;b<a;b++)
{
if (a%b==0)
{flag=1;
break;
}
}
if (flag == 0)
{count++;
c[count-1]=a;
}
}
int i,j,ecr=0;
for (i=0;i<168;i++)
{
for (j=0;j<i;j++)
{
if ( ((c[i]
c[i]
c[i])-1)%c[j]==0 && ((c[j]
c[j]
c[j])-1)%c[i]==0)
{
ecr ++;
cout<< c[i] <<'\n';
}
}
}
cout<<ecr;
return 0;
}
By trial and error p = 2, q = 7 is a solution.
And for small values for p, we can find their respective q values, with small, p (p^3 - 1) is easily computable and factorizable because (p^3 - 1) = (p-1)(p^2 + p + 1), so we just need to find whether q divides (p^2 + p + 1)
Other small values of p are 3, 5, 13, 17 which corresponds to q = 13, 31, 61, 307 respectively.
Note that the sum of q is 7+13+31+61+307=419
Since the answer must range from 0 to 999. If there exist another value of q such that the final sum is less than 1000. Then 307<q<1000-419=518
Listing down the values of prime numbers in the range: {311, 313, 317, ... 499, 503, 509}, that's a total of 34 prime numbers. Do trial and error for those possible values of q gives no solution for p. So the final answer is indeed 419.
first we do some calculation: 2^3-1=7 3^3-1=26 5^3-1=124 7^3-1=342 11^3-1=1330 13^3-1=2196 17^3-1=4912 19^3-1=6856... (the others are unnessary) p^3-1=(p-1)(p^2+p+1) let q=(p^2+p+1)/k for p>31, q>1000, so p<=31. for k=1 we get (2,7),(3,13),(5,31),(17,307), let k not equal to 1, for all p<31 p^2+p+1 has prime factors range from 2 to 19, but as calculation above shows only (13,61) is a solution where k = 3 so 7+13+31+61+307=419
By satisfying the above conditions only 3 pairs are available. these are (2,7),(3,13),(5,31),(13,61),(17,307).
If q divides p 3 − 1 then ∃ k ∈ Z such that k ⋅ q = p 3 − 1 = ( p − 1 ) ⋅ ( p 2 + p + 1 ) . As p < q then ∃ h ∈ Z such that h ⋅ q = p 2 + p + 1 .
If p divides q 3 − 1 then ∃ r ∈ Z r ⋅ p = h 3 ⋅ ( q 3 − 1 ) = ( p 2 + p + 1 ) 3 − h 3 = p 6 + 3 ⋅ p 5 + . . . 3 ⋅ p + 1 − h 3 , therefore p divides 1 − h 3 .
If h = 1 :
p q = p 2 + p + 1 2 7 3 1 3 5 3 1 7 5 7 = 3 ⋅ 1 9 1 1 1 3 3 = 7 ⋅ 1 9 1 3 1 8 3 = 3 ⋅ 6 1 1 7 3 0 7 1 9 3 8 1 = 3 ⋅ 1 2 7 2 3 5 5 3 = 7 ⋅ 7 9 2 9 8 7 1 = 1 3 ⋅ 6 7 3 1 9 9 3 = 3 ⋅ 3 3 1
Therefore q = 7, 13, 31, 307 and if h = 3 then p = 1 3 because p divides 1 − h 3 , therefore q = 61 is the only one.
7 + 1 3 + 3 1 + 3 0 7 + 6 1 = 4 1 9 .
Problem Loading...
Note Loading...
Set Loading...
Firstly, q ∣ p 3 − 1 = ( p − 1 ) ( p 2 + p + 1 ) . Clearly q does not divide p − 1 (since 0 < p − 1 < q ), hence q ∣ p 2 + p + 1 .
Now p ∣ q 3 − 1 = ( q − 1 ) ( q 2 + q + 1 ) , so there are two cases.
~~
Case 1: p divides q − 1 . Then clearly q ≥ p + 1 .
Consider the integer n = q p 2 + p + 1 . On one hand, since both the numerator and denominator of this fraction are ≡ 1 ( m o d p ) , n is also ≡ 1 ( m o d p ) . On the other hand, n ≤ ⌊ p + 1 p 2 + p + 1 ⌋ = ⌊ p + p + 1 1 ⌋ = p , since q ≥ p + 1 . Therefore n = 1 , and thus q = p 2 + p + 1 .
Checking for all prime values of p ≤ 3 1 (since 3 7 2 + 3 7 + 1 > 1 0 0 0 ), we see that the solutions in this case are ( p , q ) = ( 2 , 7 ) , ( 3 , 1 3 ) , ( 5 , 3 1 ) , ( 1 7 , 3 0 7 ) . (For all other values of p , q = p 2 + p + 1 is not prime.)
~~
Case 2: p ∣ q 2 + q + 1 . Then since q ∣ p 2 + p + 1 we have p q ∣ p 2 + q 2 + p + q + 1 .
To find the solutions in this case, let us consider the more general equation a 2 + b 2 + a + b + 1 = m a b , where a , b , m are positive integers. Without loss of generality assume a ≥ b .
We will now use the method of Vieta jumping to solve this equation. The basic idea is as follows: if ( a 0 , b 0 ) is a solution to the equation, we will create another "smaller" solution ( a 1 , b 1 ) in terms of a 0 , b 0 , such that a 1 + b 1 < a 0 + b 0 . By the same method we can create ( a 2 , b 2 ) in terms of a 1 , b 1 , and so on. But we cannot repeat this "jumping downwards" indefinitely, since a 0 + b 0 , a 1 + b 1 , a 2 + b 2 , … is a decreasing sequence of positive integers. Hence we must end at some point, say ( a n , b n ) , and by investigating what this solution can be, we will eventually be able to reconstruct ( a 0 , b 0 ) by "jumping upwards" from ( a n , b n ) .
To apply this method to the equation, rewrite the equation as a quadratic in a : a 2 + ( 1 − m b ) a + ( b 2 + b + 1 ) = 0 . Assume that ( a 0 , b 0 ) is a solution to the above equation, with a 0 ≥ b 0 . Since this equation is a quadratic in a when we fix b = b 0 , the equation has two solutions in a , namely a = a 0 and another root, say a = a ′ . Then Vieta's formulas give the following: a 0 + a ′ = m b 0 − 1 a 0 a ′ = b 0 2 + b 0 + 1 The first equation tells us that a ′ = m b 0 − 1 − a 0 is an integer, and the second equation tells us that a ′ = a 0 b 0 2 + b 0 + 1 is positive.
Moreover, if a 0 ≥ b 0 b 0 2 + b 0 + 1 , then a ′ = a 0 b 0 2 + b 0 + 1 ≤ b 0 , and we can thus choose ( a 1 , b 1 ) = ( b 0 , a ′ ) as a "smaller" solution to the equation.
Repeating this procedure, we create a sequence of solutions
( a 0 , b 0 ) , ( a 1 , b 1 ) , ( a 2 , b 2 ) , … ,
each smaller than the previous, until we encounter a solution ( a n , b n ) where a n < b n b n 2 + b n + 1 , and we can no longer jump downwards. Let us now investigate the possible values for ( a n , b n ) .
Note that b n ≤ a n < b n b n 2 + b n + 1 ≤ b n + 2 , so either a n = b n or a n = b n + 1 . Substituting both cases back into the equation and taking ( m o d a n ) , we see that the only possible solution is ( a n , b n ) = ( 1 , 1 ) . Hence m = 5 .
Now note that ( a i , b i ) = ( b i − 1 , 5 b i − 1 − a i − 1 − 1 ) for all i . Hence b i − 1 = a i and a i − 1 = 5 b i − 1 − b i − 1 = 5 a i − b i − 1 . For example: ( a n − 1 , b n − 1 ) = ( 5 a n − b n − 1 , a n ) = ( 3 , 1 ) ; ( a n − 2 , b n − 2 ) = ( 5 a n − 1 − b n − 1 − 1 , a n − 1 ) = ( 1 3 , 3 ) ; ( a n − 3 , b n − 3 ) = ( 5 a n − 2 − b n − 2 − 1 , a n − 2 ) = ( 6 1 , 1 3 ) , and so on.
Now it is simple to prove by induction that the sequence 1 , 1 , 3 , 1 3 , 6 1 , 2 9 1 , … defined by x 0 = x 1 = 1 , x i + 1 = 5 x i − x i − 1 − 1 for all i ≥ 1 , satisfies ( a n − i , b n − i ) = ( x i + 1 , x i ) for all i ≥ 0 .
Thus all solutions ( a 0 , b 0 ) must be of the form ( x n + 1 , x n ) for some n ≥ 0 .
Finally, to answer our original question, ( q , p ) = ( x n + 1 , x n ) for some n . In addition, both x n + 1 and x n are prime, and x n + 1 < 1 0 0 0 . Checking all n ≤ 4 (since x 6 > 1 0 0 0 ), we have only the solutions ( p , q ) = ( 3 , 1 3 ) , ( 1 3 , 6 1 ) .
~~
In conclusion, the only solutions to the problem are
( p , q ) = ( 2 , 7 ) , ( 3 , 1 3 ) , ( 5 , 3 1 ) , ( 1 3 , 6 1 ) , ( 1 7 , 3 0 7 ) ,
and thus the answer to the problem is 7 + 1 3 + 3 1 + 6 1 + 3 0 7 = 4 1 9 .