Mind your p's and q's cubed

Find the sum of all primes q < 1000 q<1000 such that for some prime p < q p<q , both q q divides p 3 1 p^3-1 and p p divides q 3 1 q^3-1 .


The answer is 419.

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.

10 solutions

Ang Yan Sheng
May 20, 2014

Firstly, q p 3 1 = ( p 1 ) ( p 2 + p + 1 ) q\mid p^3-1=(p-1)(p^2+p+1) . Clearly q q does not divide p 1 p-1 (since 0 < p 1 < q 0<p-1<q ), hence q p 2 + p + 1 q\mid p^2+p+1 .

Now p q 3 1 = ( q 1 ) ( q 2 + q + 1 ) p\mid q^3-1=(q-1)(q^2+q+1) , so there are two cases.

~~

Case 1: p p divides q 1 q-1 . Then clearly q p + 1 q\geq p+1 .

Consider the integer n = p 2 + p + 1 q n=\frac{p^2+p+1}{q} . On one hand, since both the numerator and denominator of this fraction are 1 ( m o d p ) \equiv 1 \pmod{p} , n n is also 1 ( m o d p ) \equiv 1\pmod{p} . On the other hand, n p 2 + p + 1 p + 1 = p + 1 p + 1 = p n\leq\lfloor\frac{p^2+p+1}{p+1}\rfloor=\lfloor p+\frac{1}{p+1}\rfloor=p , since q p + 1 q\geq p+1 . Therefore n = 1 n=1 , and thus q = p 2 + p + 1 q=p^2+p+1 .

Checking for all prime values of p 31 p\leq31 (since 3 7 2 + 37 + 1 > 1000 37^2+37+1>1000 ), we see that the solutions in this case are ( p , q ) = ( 2 , 7 ) , ( 3 , 13 ) , ( 5 , 31 ) , ( 17 , 307 ) (p,q) = (2,7),(3,13),(5,31),(17,307) . (For all other values of p p , q = p 2 + p + 1 q=p^2+p+1 is not prime.)

~~

Case 2: p q 2 + q + 1 p\mid q^2+q+1 . Then since q p 2 + p + 1 q\mid p^2+p+1 we have p q p 2 + q 2 + p + q + 1 pq\mid 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 a^2+b^2+a+b+1 = mab , where a , b , m a,b,m are positive integers. Without loss of generality assume a b a\geq 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 ) (a_0,b_0) is a solution to the equation, we will create another "smaller" solution ( a 1 , b 1 ) (a_1,b_1) in terms of a 0 , b 0 a_0,b_0 , such that a 1 + b 1 < a 0 + b 0 a_1+b_1<a_0+b_0 . By the same method we can create ( a 2 , b 2 ) (a_2,b_2) in terms of a 1 , b 1 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 , a_0+b_0,a_1+b_1,a_2+b_2,\ldots is a decreasing sequence of positive integers. Hence we must end at some point, say ( a n , b n ) (a_n,b_n) , and by investigating what this solution can be, we will eventually be able to reconstruct ( a 0 , b 0 ) (a_0,b_0) by "jumping upwards" from ( a n , b n ) (a_n,b_n) .

To apply this method to the equation, rewrite the equation as a quadratic in a a : a 2 + ( 1 m b ) a + ( b 2 + b + 1 ) = 0. a^2+(1-mb)a+(b^2+b+1)=0. Assume that ( a 0 , b 0 ) (a_0,b_0) is a solution to the above equation, with a 0 b 0 a_0\geq b_0 . Since this equation is a quadratic in a a when we fix b = b 0 b=b_0 , the equation has two solutions in a a , namely a = a 0 a=a_0 and another root, say a = a 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 a_0+a'=mb_0-1\\ a_0a'=b_0^2+b_0+1 The first equation tells us that a = m b 0 1 a 0 a'=mb_0-1-a_0 is an integer, and the second equation tells us that a = b 0 2 + b 0 + 1 a 0 a'=\frac{b_0^2+b_0+1}{a_0} is positive.

Moreover, if a 0 b 0 2 + b 0 + 1 b 0 a_0\geq\frac{b_0^2+b_0+1}{b_0} , then a = b 0 2 + b 0 + 1 a 0 b 0 a'=\frac{b_0^2+b_0+1}{a_0}\leq b_0 , and we can thus choose ( a 1 , b 1 ) = ( b 0 , a ) (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 ) , (a_0,b_0),(a_1,b_1),(a_2,b_2),\ldots ,

each smaller than the previous, until we encounter a solution ( a n , b n ) (a_n,b_n) where a n < b n 2 + b n + 1 b n a_n<\frac{b_n^2+b_n+1}{b_n} , and we can no longer jump downwards. Let us now investigate the possible values for ( a n , b n ) (a_n,b_n) .

Note that b n a n < b n 2 + b n + 1 b n b n + 2 b_n\leq a_n<\frac{b_n^2+b_n+1}{b_n}\leq b_n+2 , so either a n = b n a_n=b_n or a n = b n + 1 a_n=b_n+1 . Substituting both cases back into the equation and taking ( m o d a n ) \pmod{a_n} , we see that the only possible solution is ( a n , b n ) = ( 1 , 1 ) (a_n,b_n)=(1,1) . Hence m = 5 m=5 .

Now note that ( a i , b i ) = ( b i 1 , 5 b i 1 a i 1 1 ) (a_i,b_i)=(b_{i-1},5b_{i-1}-a_{i-1}-1) for all i i . Hence b i 1 = a i b_{i-1}=a_i and a i 1 = 5 b i 1 b i 1 = 5 a i b i 1 a_{i-1}=5b_{i-1}-b_i-1=5a_i-b_i-1 . For example: ( a n 1 , b n 1 ) = ( 5 a n b n 1 , a n ) = ( 3 , 1 ) ; (a_{n-1},b_{n-1})=(5a_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 ) = ( 13 , 3 ) ; (a_{n-2},b_{n-2})=(5a_{n-1}-b_{n-1}-1,a_{n-1})=(13,3); ( a n 3 , b n 3 ) = ( 5 a n 2 b n 2 1 , a n 2 ) = ( 61 , 13 ) , (a_{n-3},b_{n-3})=(5a_{n-2}-b_{n-2}-1,a_{n-2})=(61,13), and so on.

Now it is simple to prove by induction that the sequence 1 , 1 , 3 , 13 , 61 , 291 , 1,1,3,13,61,291,\ldots defined by x 0 = x 1 = 1 x_0=x_1=1 , x i + 1 = 5 x i x i 1 1 x_{i+1}=5x_i-x_{i-1}-1 for all i 1 i\geq1 , satisfies ( a n i , b n i ) = ( x i + 1 , x i ) (a_{n-i},b_{n-i})=(x_{i+1},x_i) for all i 0 i\geq0 .

Thus all solutions ( a 0 , b 0 ) (a_0,b_0) must be of the form ( x n + 1 , x n ) (x_{n+1},x_n) for some n 0 n\geq0 .

Finally, to answer our original question, ( q , p ) = ( x n + 1 , x n ) (q,p)=(x_{n+1},x_n) for some n n . In addition, both x n + 1 x_{n+1} and x n x_n are prime, and x n + 1 < 1000 x_{n+1}<1000 . Checking all n 4 n\leq4 (since x 6 > 1000 x_6>1000 ), we have only the solutions ( p , q ) = ( 3 , 13 ) , ( 13 , 61 ) (p,q)=(3,13),(13,61) .

~~

In conclusion, the only solutions to the problem are

( p , q ) = ( 2 , 7 ) , ( 3 , 13 ) , ( 5 , 31 ) , ( 13 , 61 ) , ( 17 , 307 ) (p,q)=(2,7),(3,13),(5,31),(13,61),(17,307) ,

and thus the answer to the problem is 7 + 13 + 31 + 61 + 307 = 419 7+13+31+61+307=419 .

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.

Calvin Lin Staff - 7 years ago
Derek Khu
May 20, 2014

First, we note that p 3 1 = ( p 1 ) ( p 2 + p + 1 ) p^3-1=(p-1)(p^2+p+1) , so q p 3 1 q p 1 q \mid p^3-1 \Rightarrow q \mid p-1 or q p 2 + p + 1 q \mid p^2+p+1 . But q > p > p 1 q > p > p-1 , so q p 1 q \nmid p-1 . So q p 2 + p + 1 q \mid p^2+p+1 . Similarly, p q 3 1 p q 1 p \mid q^3-1 \Rightarrow p \mid q-1 or p q 2 + q + 1 p \mid q^2+q+1 . So we will need to consider two cases: p q 1 p \mid q-1 and p q 2 + q + 1 p \mid q^2+q+1 .

Case 1: p q 1 p \mid q-1

Let q 1 = a p q-1=ap . Then q = a p + 1 q=ap+1 . Since q > p q>p , then a 1 a \geq 1 . Also since q p 2 + p + 1 q \mid p^2+p+1 , we can let p 2 + p + 1 = k q p^2+p+1=kq for some positive integer k k ( k k is clearly non-zero). Express k k in the form b p + c bp+c , where b , c b,c are non-negative integers with 0 c < p 0 \leq c < p . Then p 2 + p + 1 = ( b p + c ) ( a p + 1 ) p^2+p+1=(bp+c)(ap+1) . Taking modulo p p , we easily see that c 1 ( m o d p ) c \equiv 1 \pmod{p} , so c = 1 c=1 . Thus, p 2 + p + 1 = ( b p + 1 ) ( a p + 1 ) p^2+p+1=(bp+1)(ap+1) . If b 1 b \geq 1 , then p 2 + p + 1 ( p + 1 ) ( p + 1 ) = p 2 + 2 p + 1 p^2+p+1 \geq (p+1)(p+1) = p^2+2p+1 , which is clearly false. So b = 0 b=0 . Therefore, p 2 + p + 1 = ( 0 p + 1 ) ( a p + 1 ) = a p + 1 = q p^2+p+1=(0p+1)(ap+1)=ap+1=q . Indeed, if q = p 2 + p + 1 q=p^2+p+1 , then p q 1 p \mid q-1 (and hence p q 3 1 p \mid q^3-1 ) and q p 2 + p + 1 q \mid p^2+p+1 (and hence q p 3 1 q \mid p^3-1 ). So we just need to find all primes q q of the form p 2 + p + 1 p^2+p+1 (where p p is prime) below 1000 1000 . Since q < 1000 q < 1000 , p < 1000 < 32 p < \sqrt{1000} < 32 . The possible p p are 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 2,3,5,7,11,13,17,19,23,29 and 31 31 . If p 1 ( m o d 3 ) p \equiv 1 \pmod{3} , then q 1 2 + 1 + 1 0 ( m o d 3 ) q \equiv 1^2+1+1 \equiv 0 \pmod{3} is not prime (note that q > 3 q>3 since 2 2 + 2 + 1 > 3 2^2+2+1>3 ). So we only need to check p = 2 , 3 , 5 , 11 , 17 , 23 p=2,3,5,11,17,23 and 29 29 . The corresponding q q are 7 , 13 , 31 , 133 , 307 , 553 7,13,31,133,307,553 and 871 871 . The only primes among these are 7 , 13 , 31 7,13,31 and 307 307 ( 133 133 and 553 553 are divisible by 7 7 ; 871 871 is divisible by 13 13 ), so the only pairs of ( p , q ) (p,q) are ( 2 , 7 ) , ( 3 , 13 ) , ( 5 , 31 ) (2,7),(3,13),(5,31) and ( 17 , 307 ) (17,307) .

Case 2: p q 2 + q + 1 p \mid q^2+q+1

Instead of primes p , q p,q , we first consider generally two integers s , t s,t , where 1 s t 1 \leq s \leq t , such that t s 2 + s + 1 t \mid s^2+s+1 and s t 2 + t + 1 s \mid t^2+t+1 . Note that s = p s=p and t = q t=q is subsumed under this general definition. Let t r = s 2 + s + 1 tr=s^2+s+1 for some positive integer r r ( 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 gcd(s,t) \mid tr-s^2-s \Rightarrow gcd(s,t) \mid 1 \Rightarrow gcd(s,t)=1 . Since t r 1 ( m o d s ) tr \equiv 1 \pmod{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 ) t^2(r^2+r+1) \equiv (tr)^2+t(tr)+t^2 \equiv 1+t+t^2 \equiv 0 \pmod{s} . Since g c d ( s , t ) = 1 gcd(s,t)=1 , then we can deduce that r 2 + r + 1 0 ( m o d s ) r^2+r+1 \equiv 0 \pmod{s} , i.e. s r 2 + r + 1 s \mid r^2+r+1 . Thus, if t s 2 + s + 1 t \mid s^2+s+1 and s t 2 + t + 1 s \mid t^2+t+1 , then s r 2 + r + 1 s \mid r^2+r+1 and r s 2 + s + 1 r \mid s^2+s+1 (remember that t r = s 2 + s + 1 tr=s^2+s+1 ). This means that from any pair of integers ( s , t ) (s,t) satisfying t s 2 + s + 1 t \mid s^2+s+1 and s t 2 + t + 1 s \mid t^2+t+1 , we can generate another pair of integers ( r , s ) (r,s) satisfying s r 2 + r + 1 s \mid r^2+r+1 and r s 2 + s + 1 r \mid s^2+s+1 . In particular, we can call ( r , s ) (r,s) the descendant of ( s , t ) (s,t) if r s r \leq s .

If t = s t=s , then r = s 2 + s + 1 s = s + 1 + 1 s r = \frac{s^2+s+1}{s} = s+1+\frac{1}{s} . Since r r is an integer, then s = 1 s=1 . But this means that r = 3 > s r=3>s , so ( 1 , 1 ) (1,1) does not have any descendants. If t = s + 1 t=s+1 , then r = s 2 + s + 1 s + 1 = s + 1 s + 1 r = \frac{s^2+s+1}{s+1} = s+\frac{1}{s+1} which obviously cannot be an integer. If t s + 2 t \geq s+2 , then r = s 2 + s + 1 t s 2 + s + 1 s + 2 = s s 1 s + 2 s r = \frac{s^2+s+1}{t} \leq \frac{s^2+s+1}{s+2} = s-\frac{s-1}{s+2} \leq s since s 1 0 s-1 \geq 0 . So ( r , s ) (r,s) is a descendant of ( s , t ) (s,t) in this case. Also, since g c d ( s , t ) = 1 gcd(s,t) = 1 , then s t s \neq t if ( s , t ) ( 1 , 1 ) (s,t) \neq (1,1) . Thus, with the exception of ( 1 , 1 ) (1,1) , we have s < t s < t and r s r \leq s , so s + t > r + s 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 ) (s,t) such that 1 s t 1 \leq s \leq t , t s 2 + s + 1 t \mid s^2+s+1 and s t 2 + t + 1 s \mid 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 ) (1,1) .

We have proven that each pair ( s , t ) (s,t) (satisfying 1 s t 1 \leq s \leq t , t s 2 + s + 1 t \mid s^2+s+1 and s t 2 + t + 1 s \mid t^2+t+1 ), with the exception of ( 1 , 1 ) (1,1) , has exactly one descendant ( s 2 + s + 1 t , s ) (\frac{s^2+s+1}{t},s) . Now we suppose a descendant ( r , s ) (r,s) of an ancestor ( s , t ) (s,t) has another ancestor ( s , T ) (s,T) . Then we have s 2 + s + 1 T = s 2 + s + 1 t \frac{s^2+s+1}{T} = \frac{s^2+s+1}{t} , so we can easily see that T = t T = t . Thus, each pair ( r , s ) (r,s) (satisfying 1 r s 1 \leq r \leq s , s t 2 + t + 1 s \mid t^2+t+1 and r s 2 + s + 1 r \mid s^2+s+1 ) has exactly one ancestor as well. Specifically, this ancestor is ( s , s 2 + s + 1 r ) (s,\frac{s^2+s+1}{r}) . This is important because it means that from any pair ( r , s ) (r,s) such that 1 r s 1 \leq r \leq s , s t 2 + t + 1 s \mid t^2+t+1 and r s 2 + s + 1 r \mid s^2+s+1 , we can re-construct its unique ancestor, which is ( s , s 2 + s + 1 r ) (s,\frac{s^2+s+1}{r}) .

Now, it is possible to list all the ( s , t ) (s,t) satisfying 1 s t 1 \leq s \leq t , t s 2 + s + 1 t \mid s^2+s+1 and s t 2 + t + 1 s \mid t^2+t+1 using the ancestor-descendant relationships and starting from the descendant ( 1 , 1 ) (1,1) . In particular, we are only looking at the pairs ( s , t ) (s,t) where both s s and t t are prime and where t < 1000 t < 1000 . Since the pairs will only get larger and larger, we can stop when the larger number of the pair exceeds 1000 1000 . The pairs are: ( 1 , 1 ) , ( 1 , 3 ) , ( 3 , 13 ) , ( 13 , 61 ) , ( 61 , 291 ) (1,1), (1,3), (3,13), (13,61), (61,291) and ( 291 , 1393 ) (291,1393) . Since 1 1 and 291 = 3 97 291=3\cdot97 are not primes, then the only valid pairs ( p , q ) (p,q) are ( 3 , 13 ) (3,13) and ( 13 , 61 ) (13,61) .

Combining the results we have for both cases, we have ( p , q ) = ( 2 , 7 ) , ( 3 , 13 ) , ( 5 , 31 ) , ( 13 , 61 ) (p,q)=(2,7),(3,13),(5,31),(13,61) and ( 17 , 307 ) (17,307) . The sum of all q q is thus 7 + 13 + 31 + 61 + 307 = 419 7+13+31+61+307=419 .

Bojan Serafimov
May 20, 2014

If p = 2 p = 2 , then the only possible q q is q = 7 q = 7 , so we will consider this solution and from now on take p , q p, q as odd primes.

q ( p 1 ) ( p 2 + p + 1 ) q \mid (p - 1)(p^2 + p + 1) . Since they are primes, and q > p q > p , it follows that q p 2 + p + 1 q \mid p^2 + p + 1 , or k q = p 2 + p + 1 kq = p^2 + p + 1 , where k k is an integer, and also is relatively prime with p p . Now we have 2 cases:

First case: p q 1 p \mid q - 1 . Substituting for q q , we get p p 2 + p + 1 k 1 p \mid \frac{p^2 + p + 1}{k} - 1 now, because ( k , p ) = 1 (k, p) = 1 , it follows that p 1 k p \mid 1 - k . The only solution is k = 1 k = 1 . Substituting in the other equation gives: q = p 2 + p + 1 q = p^2 + p + 1 . We test all small primes p, and see that only for p 3 , 5 , 17 p \in {3, 5, 17} , p 2 + p + 1 p^2 + p + 1 is also a prime, so q 13 , 31 , 307 q \in {13, 31, 307}

[Note: This solution doesn't justify why we cannot have k = p + 1 , 2 p + 1 , k=p+1, 2p+1, \ldots This follows from observing that since q p + 1 q \geq p+1 , thus k = p 2 + p + 1 q < p + 1 k= \frac {p^2+p+1}{q} < p+1 , which is hinted at in the second case. -Calvin]

Second case: p q 2 + q + 1 p \mid 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 = ( p 2 + p + 1 q ) 2 + p 2 + p + 1 q + 1 q 2 + q + 1 q 2 0 ( m o d p ) k^2 + k + 1 = \left( \frac{p^2 + p + 1}{q} \right) ^2 + \frac{p^2 + p + 1}{q} + 1 \equiv \frac{q^2 + q + 1}{q^2} \equiv 0 \pmod p . If p > 2 p > 2 it follows that: k = p 2 + p + 1 q p 2 + p + 1 p + 2 = p 1 + 4 p + 2 < p k = \frac{p^2 + p + 1}{q} \leq \frac{p^2 + p + 1}{p+2} = p - 1 + \frac{4}{p+2} < p . From the last 2 2 statements it follows that if ( p , q ) (p, q) is a solution to the system, with q > p > 2 q > p > 2 , then ( p 2 + p + 1 q , p ) \left( \frac{p^2 + p + 1}{q} , p\right) is a smaller solution. Reducing the solutions this way, they will all trace to the solution with p = 1 p = 1 , that is ( 1 , 3 ) (1, 3) . So we can start from ( 1 , 3 ) (1, 3) and increase the solution to get the pairs: ( 1 , 3 ) , ( 3 , 13 ) , ( 13 , 61 ) , ( 61 , 291 ) , ( 291 , 1393 ) , (1, 3), (3, 13), (13, 61), (61, 291), (291, 1393), \ldots . 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 > 1000 q > 1000 .

So the solutions are: 7 , 13 , 31 , 307 , 61 {7, 13, 31, 307, 61} .

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 ( 13 , 61 ) (13, 61) which arose only in case 2.

Common mistakes.

  1. Claiming that if p 1 k p \mid 1-k then we must have k = 1 k=1 . This is not true, as the values can be negative integers. For example, 5 10 5 \mid -10 .

  2. Assuming that p 31 p \leq 31 'because' otherwise p 2 + p + 1 = q p^2 + p + 1 = q contradicts q < 1000 q < 1000 .

  3. Merely listing out sets which satisfy the conditions, without explaining why this is all the possible sets.

Calvin Lin Staff - 7 years ago
James Aaronson
May 20, 2014

We will solve this by finding the two families of solutions to p q 3 1 p \mid q^3 - 1 and q p 3 1 q \mid p^3 - 1 .

Suppose we have a solution. Then q ( p 1 ) ( p 2 + p + 1 ) q \mid (p-1)(p^2+p+1) . But q ( p 1 ) q \nmid (p-1) since q > p q > p , so q p 2 + p + 1 q \mid p^2+p+1 .

Our two families will arise from p q 1 p \mid q-1 and p q 2 + q + 1 p \mid q^2 + q + 1 respectively.

Case 1: p q 1 p \mid q-1

We will show that, in this case, q = p 2 + p + 1 q = p^2 + p + 1 . Indeed, suppose not; then q r = p 2 + p + 1 qr = p^2 + p + 1 for some r r . But q q is 1 mod p p , and so is the RHS, hence r r is. But that means that q q and r r are both at least p + 1 p + 1 , so q r p 2 + 2 p + 1 qr \geq p^2 + 2p + 1 , contradiction.

This is one family; ( p , q ) (p,q) such that q = p 2 + p + 1 q = p^2 + p + 1 . It is easy to see that this works, provided that both p p and q q are prime.

For the solutions with q 1000 q \leq 1000 , we need simply check all primes p 32 p \leq 32 . This is not a difficult check, and results in the list (2,3,5,17) for p p , and (7,13,31,307) correspondingly for q q .

Case 2: p q 2 + q + 1 p \mid q^2 + q + 1

Let us instead consider positive integer solutions to x y 2 + y + 1 x \mid y^2 + y + 1 and y x 2 + x + 1 y \mid 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 = y 2 + y + 1 x z = \frac{y^2 + y + 1}{x} . Note that by the first relation, z z is an integer and z y 2 + y + 1 z \mid y^2 + y + 1 .

Also, working modulo y y , z = 1 x z = \frac{1}{x} , and so z z is the other root to the equation t 2 + t + 1 0 t^2 + t + 1 \equiv 0 mod y y . Hence, if ( x , y ) (x,y) solved the relation, then so will ( z , y ) (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 u_{n-1}u_{n+1} = u_n^2 + u_n + 1 . Indeed, suppose we have a solution outside that sequence, ( x , y ) (x,y) , with x y x \geq y . Take the solution with smallest x + y x + y . If x = y 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 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 1000 q \leq 1000 are (3,13) and (13,61), introducing a fifth solution, as we’ve already found (3,13).

Hence, q { 7 , 13 , 31 , 61 , 307 } q \in \{7,13,31,61,307\} , with sum 419.

"Also, working modulo y y , z = 1 x z = \frac{1}{x} , and so z z is the other root to the equation t 2 + t + 1 0 t^2 + t + 1 \equiv 0 mod y y ." One has to be more careful here: if y y is not prime, the quadratic equation modulo y y may have more than two solutions. A very nicely written solution otherwise.

Calvin Lin Staff - 7 years ago
Calvin Lin Staff
May 13, 2014

Because p < q p<q , q q cannot divide p 1 p-1 , so q p 2 + p + 1 q \mid p^2+p+1 . For p q 3 1 p \mid q^3-1 two cases exist.

Case 1. p q 1 p\mid q-1 . Suppose q = p k + 1 q=pk+1 . Because q p 2 + p + 1 q\mid 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 q\mid p^2k+pk+k=p(pk+1)+pk-p+k=p(pk+1)+(pk+1)+k-p-1

So, q = p k + 1 q=pk+1 must divide k p + 1 k-p+1 . Because q p 2 + p + 1 , q\leq p^2+p+1, k p 2 + p p , k \leq \frac{p^2+p}{p}, so k p + 1 k\leq p+1 . On the other hand, k 1 k\geq 1 , so k p 1 p > q k-p-1\geq -p>-q . So the only way q q could divide k p 1 k-p-1 is if k p 1 = 0 k-p-1=0 . This implies that q = p 2 + p + 1 q=p^2+p+1 .

If p = 2 p=2 , then q = 7 q=7 . If p = 3 p=3 , then q = 13 q=13 . If p > 3 p>3 , one can easily check that if p 1 ( m o d 6 ) p \equiv 1 \pmod{6} , then q 1 + 1 + 1 = 3 ( m o d 6 ) q \equiv 1 + 1 + 1 = 3 \pmod{6} , so we must have p 5 ( m o d 6 ) p\equiv 5\pmod 6 . We get pairs ( p , q ) = ( 5 , 31 ) (p,q)=(5,31) , ( 17 , 307 ) (17,307) . Note that for p = 11 p=11 and p = 23 p=23 the number p 2 + p + 1 p^2+p+1 is divisible by 7 7 ; for p = 29 p=29 it is divisible by 13 13 (by easy calculations modulo the corresponding primes). For all other p p , p 35 p\geq 35 so the number p 2 + p + 1 p^2+p+1 is greater than 1000 1000 .

Case 2. p q 2 + q + 1 p\mid q^2+q+1 . In this case, we consider a more general problem: find all pairs of positive integers n < m n<m , not necessarily prime, such that n m 2 + m + 1 n\mid m^2+m+1 and m n 2 + n + 1 m\mid n^2+n+1 . One can check that such n n and m m must be coprime. If n 2 + n + 1 = m k n^2+n+1=mk , then obviously k n 2 + n + 1 k\mid n^2+n+1 and, a little less obviously, n k 2 + k + 1 n\mid k^2+k+1 (because k 1 m ( m o d n ) k\equiv \frac{1}{m} \pmod n and m 2 + m + 1 0 ( m o d n ) m^2+m+1 \equiv 0 \pmod n ).

Simple inequalities show that, unless ( n , m ) = ( 1 , 3 ) , (n,m)=(1,3), k < n k<n . So any pair ( n , m ) (n,m) can be reduced to ( 1 , 3 ) (1,3) . Backtracking, we get the following sequence of pairs ( n , m ) (n,m) : ( 1 , 3 ) ( 3 , 13 ) ( 13 , 61 ) ( 61 , 291 ) ( 291 , 1393 ) . . . (1,3)\to (3,13)\to (13,61)\to (61,291)\to (291,1393)\to ... Out of these, ( 13 , 61 ) (13,61) is a pair of primes, not considered before, and 291 291 is divisible by 3 3 .

Putting this all together, we get five possible prime pairs: ( 2 , 7 ) , ( 3 , 13 ) , ( 5 , 31 ) , ( 13 , 61 ) , ( 17 , 307 ) (2,7),\ (3,13),\ (5,31),\ (13,61),\ (17,307) So the answer is 7 + 13 + 31 + 61 + 307 = 419 7+13+31+61+307=419 .

Chaitanya Reddy
May 20, 2014

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; }




Computer-based, no math ideas... should know better at this level.

Calvin Lin Staff - 7 years ago
Pi Han Goh
May 20, 2014

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.

The fact that the sum is supposed to be less than 1000 is used, together with (probably, computer-assisted, though not declared so) brute force count. Also, there seems to be a gap in the argument, because first small values of p are considered, and then some values for q.

Calvin Lin Staff - 7 years ago

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 q divides p 3 1 p^3-1 then k \exists k \in Z such that k q = p 3 1 = ( p 1 ) ( p 2 + p + 1 ) k \cdot q = p^3-1 = (p-1) \cdot (p^2+p+1) . As p < q p < q then h \exists h \in Z such that h q = p 2 + p + 1 h \cdot q = p^2 + p + 1 .

If p divides q 3 1 q^3 -1 then r \exists r \in 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 r \cdot p = h^3 \cdot (q^3-1) = (p^2 + p + 1)^3 - h^3 = p^6 + 3 \cdot p^5 + ... 3 \cdot p + 1 - h^3 , therefore p p divides 1 h 3 1 - h^3 .

If h = 1 h=1 :

p q = p 2 + p + 1 2 7 3 13 5 31 7 57 = 3 19 11 133 = 7 19 13 183 = 3 61 17 307 19 381 = 3 127 23 553 = 7 79 29 871 = 13 67 31 993 = 3 331 \begin{matrix} p \xrightarrow{\;\;\;\;\;\;} q=p^2+p+1 \\ 2 \xrightarrow{\;\;\;\;\;\;} 7\\ 3 \xrightarrow{\;\;\;\;\;\;} 13 \\ 5 \xrightarrow{\;\;\;\;\;\;} 31 \\ 7 \xrightarrow{\;\;\;\;\;\;} 57 = 3\cdot 19 \\ 11 \xrightarrow{\;\;\;\;\;\;} 133 = 7 \cdot 19 \\ 13 \xrightarrow{\;\;\;\;\;\;} 183 = 3 \cdot 61 \\ 17 \xrightarrow{\;\;\;\;\;\;} 307\\ 19 \xrightarrow{\;\;\;\;\;\;} 381 = 3 \cdot 127\\ 23 \xrightarrow{\;\;\;\;\;\;} 553 = 7 \cdot 79 \\ 29 \xrightarrow{\;\;\;\;\;\;} 871 = 13 \cdot 67 \\ 31 \xrightarrow{\;\;\;\;\;\;} 993 = 3 \cdot 331 \\ \end{matrix}

Therefore q = 7, 13, 31, 307 and if h = 3 h = 3 then p = 13 p = 13 because p p divides 1 h 3 1 - h^3 , therefore q = 61 is the only one.

7 + 13 + 31 + 307 + 61 = 419 7 + 13 + 31 + 307 + 61 = 419 .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...