Find the sum of all positive integers N such that 1 ≤ N ≤ 1 0 0 0 , N = p q , where p < q are primes, and N divides 2 q − p − 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.
This was the best solution submitted, but it has a serious mistake in the third paragraph. It is not clear that p-1 must divide q-1. It is possible that 2^d is 1 modulo p for some d|(p-1), and then d|(q-1).
Common incorrect solutions included using a computer to search for the answer. This can give you the correct answer, and for a reasonably proficient programmer with any reasonably computer and appropriate software, it is probably the most "time efficient" method. However, this cannot be accepted as a solution, because "filling in the details" is not really possible. Also, one can prove that such number N is a pseudo-prime base 2 (that is N|(2^N-2)) and then get the right answer from a known table of pseudo-prime numbers. However, this is, ultimately, an essentially computer-based solution, the only difference is that someone else has already done the dirty work.
A number N=p*q, where p and q are different primes is calles a pseudoprime to base a if a^{N-1} \equiv 0 \pmod N. For obvious reasons p cannot be 2, hence N has to be odd. N also sastisfies 2^q \equiv 2^p \pmod N which simplifies to 2^{N} \equiv \pmod N. Only primes and pseudoprimes sastify the last equation, since we look for nonprimes we have to look at all pseudoprimes smaller or equal to 1000 with 2 factors. This criteria only sastifies 341.
q>p therefore p<31. 2^(q-1)-1 divide by q and 2^(q-p) - 1 divide by q, therefore 2^(p-1)-1 divide by q. 2^(p-1)-1 also divide by p, so 2^(p-1)-1 divides by N. choose p is prime from 3 to 29, and find q. there is only p=11, q=31 is satisfied. Then, N= 341.
We denote the greatest common divisor of n and m by g cd ( n , m ) .
By the Fermat's theorem, 2 p − 1 ≡ 1 ( m o d p ) . Because 2 q − p ≡ 1 ( m o d p ) , this implies that 2 q − 1 ≡ 1 ( m o d p ) . Also, by Fermat's theorem 2 q − 1 ≡ 1 ( m o d q ) . Finally, 2 p − 1 = 2 q − 1 / 2 q − p ≡ 1 ( m o d q ) . So p q divides g cd ( 2 p − 1 − 1 , 2 q − 1 − 1 ) .
The following lemma is very useful.
Lemma. For any integer k ≥ 2 , and positive integers n and m , g cd ( k n − 1 , k m − 1 ) = k g cd ( n , m ) − 1 Proof. Suppose n < m . We note that g cd ( k n − 1 , k m − 1 ) = g cd ( k n − 1 , ( k n − 1 ) ⋅ k m − n + ( k m − n − 1 ) ) = g cd ( k n − 1 , k m − n − 1 ) So we can run Euclid's algorithm (with subtraction steps) on the numbers of the form k i − 1 parallel to the same algorithm for the powers i . The result follows.
Applying this lemma to 2 p − 1 − 1 and 2 q − 1 − 1 , we get that for d = g cd ( p − 1 , q − 1 ) the following are true: p q ∣ 2 d − 1 , d ∣ ( p − 1 ) , d ∣ ( q − 1 ) .
Because p < q and p q < 1 0 0 0 , one can see that p ≤ 2 9 . We will consider several cases, based on what p can be. Note that p = 2 .
If p = 3 , then d ∣ 2 . Both 2 1 − 1 = 1 and 2 2 − 1 = 3 are not divisible by a pair of distinct primes, so this is impossible.
If p = 5 , then d ∣ 4 . The above calculations show that d = 1 , 2 are not suitable, so we only need to check d = 4 . Then 2 d − 1 = 3 ⋅ 5 , so we have no candidate for q .
If p = 7 , then d ∣ 6 . If d = 3 , then 2 d − 1 = 7 , and if d = 6 , then 2 d − 1 = 6 3 = 3 2 ⋅ 7 . Neither works.
If p = 1 1 , then d ∣ 1 0 . If d = 5 , then 2 d − 1 = 3 1 , which is not divisible by p . If d = 1 0 , then 2 d − 1 = 1 0 2 3 = 3 ⋅ 1 1 ⋅ 3 1 . Note that p = 1 1 and q = 3 1 work, which gives N = 3 4 1 .
If p = 1 3 , then d ∣ 1 2 . The above calculations show that d = 1 , 2 , 3 , 4 , 6 do not yield solutions, so we only need to consider d = 1 2 . Since 2 1 2 − 1 = ( 2 6 − 1 ) ( 2 6 + 1 ) = 3 2 ⋅ 5 ⋅ 7 ⋅ 1 3 , so it does not work.
If p = 1 7 , then d ∣ 1 6 . The above calculations show that d = 1 , 2 , 4 do not yield solutions, so we should check d = 8 and d = 1 6 . If d = 8 , then 2 8 − 1 = 2 5 5 = 3 ⋅ 5 ⋅ 1 7 , which doesn't yield a valid q . If d = 1 6 , then 2 1 6 − 1 = ( 2 8 − 1 ) ( 2 8 + 1 ) = 2 5 5 ⋅ 2 5 7 = 3 ⋅ 5 ⋅ 1 7 ⋅ 2 5 7 . But 1 7 × 2 5 7 > 1 0 0 0 , hence this has no solutions.
If p = 1 9 , then d ∣ 1 8 and q < p 1 0 0 0 < 5 3 . The above calculations show that d = 1 , 2 , 3 , 6 do not yield solutions, so we should check d = 9 and d = 1 8 . If d = 9 , then 2 9 − 1 = 5 1 1 = 7 ⋅ 7 3 . This does not work because 1 9 × 7 3 > 1 0 0 0 . If d = 1 8 , then 2 1 8 − 1 = 5 1 1 ⋅ 5 1 3 = ( 7 ⋅ 7 3 ) ⋅ ( 3 3 ⋅ 1 9 ) , which likewise has no solutions.
If p = 2 3 , then d = 1 1 or d = 2 2 . In both cases, 2 2 ∣ ( q − 1 ) , so the smallest q could be is 6 7 . But 2 2 ⋅ 6 7 > 1 0 0 0 .
If p = 2 9 , then d must be a multiple of 7 , so the smallest q could be is 4 3 , which is too big.
So, the only such number N up to 1 0 0 0 is 3 4 1 , and the answer is 3 4 1 .
I did pretty much the same thing, except that I iterated over d , since d ≤ 3 0 and 2 d − 1 had to be divisible by at least two primes ( p and q ).
Iterate over all pairs of primes (p,q) such that n=p*q<=1000 To check whether N divides 2^{q-p} - 1 we can see that 2^{q-p} - 1 is sum of 2^k where k is from 0 to q-p-1. Therefore we can calculate S which is sum of (2^k) mod N. If S mod N = 0 then N divides S, then we add N to the result X. Finally the result is the 3 last digits of X.
Problem Loading...
Note Loading...
Set Loading...
Since 2 q − p − 1 is odd, p and q must each be odd primes. Also, since p q ≤ 1 0 0 0 and p < q , we have p ≤ 3 1 . Therefore, p = 3, 5, 7, 11, 13, 17, 19, 23, 29, or 31.
Thinking in terms of modular arithmetic, we have 2 q − p ≡ 1 ( m o d p q ) . Since p and q are relatively prime, this means 2 q − p ≡ 1 m o d p and 2 q − p ≡ 1 m o d q .
2 q − p ≡ 1 m o d p implies that 2 q ≡ 2 p m o d p . By Fermat's Little Theorem, 2 p ≡ 2 m o d p . This means that 2 q − 1 ≡ 1 m o d p . But since, 2 p − 1 ≡ 1 m o d p and p < q, we must have p − 1 ∣ q − 1 .
Likewise, we find that 2 p − 1 ≡ 1 m o d q . This is a much more restrictive condition.
Consider each case for p:
If p = 31, then since pq < 1000 we must have q = 31, which contradicts p < q.
If p = 29, then p-1=28 and there are no primes q for which p − 1 ∣ q − 1 and p q < 1 0 0 0 . The same is true for p = 23 and 17.
If p = 19, then p-1=18 and the only prime q for which p − 1 ∣ q − 1 and p q < 1 0 0 0 is q = 37.
If p = 13, then p-1 = 12 and the only primes q for which p − 1 ∣ q − 1 and p q < 1 0 0 0 are q = 61 and 73.
If p = 11, then p-1 = 10 and the only primes q for which p − 1 ∣ q − 1 and p q < 1 0 0 0 are q = 31, 41, 61, and 71.
If p = 7, then p-1 = 6 and there are no primes q for which p − 1 ∣ q − 1 and p q < 1 0 0 0 . The same is true for p = 5 and 3.
So our possible candidates for solutions are (p,q) = (19,37), (13, 61), (13, 73), (11, 31), (11, 41), (11, 61), and (11, 71). We now check to see for which candidates 2 p − 1 ≡ 1 m o d q .
Using the repeated squaring technique to compute each situation, we find that only 2 1 0 ≡ 1 m o d 3 1 . So the only solution is p = 11, q = 31, which gives N = 341.