Testing 10 digit numbers

For any given integer m , m, define a sequence of integers as follows. x 0 , m = m ; x i + 1 , m = x i , m 2 + 2 x i , m , i = 0 , 1 , 2 , . . . x_{0,m} =m;\ x_{i+1, m}=x_{i,m}^2+2x_{i,m},\ i=0,1,2,...

Let N N be the sum of all integer 3 n 1 0 10 3\leq n \leq 10^{10} such that x n , m x_{n,m} is divisible by n n for every integer m , m, 1 m n 2. 1\leq m\leq n-2.

What are the last 3 digits of N N ?


The answer is 819.

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.

5 solutions

Leo Lai
May 20, 2014

the only such n n are the Fermat primes. To prove this, first add 1 to both sides of the recursion to get x i + 1 , m + 1 = x i , m 2 + 2 x i , m + 1 = ( x i , m + 1 ) 2 x_{i+1,m}+1=x_{i,m}^2+2x_{i,m}+1=(x_{i,m}+1)^2 Use this equation n n times to get the general formula x n , m + 1 = ( x 0 , m + 1 ) 2 n = ( m + 1 ) 2 n x_{n,m}+1=(x_{0,m}+1)^{2^n}=(m+1)^{2^n} Let l = m + 1 l=m+1 , then the condition reduces to for all 2 l n 1 2\leq l\leq n-1 , l 2 n 1 m o d n l^{2^n}\equiv 1\mod n .

Let p p be a prime divisor of n n , and let l = n / p l=n/p .If l > 1 l>1 , then since it is a divisor of n n , ( l , n ) > 1 (l,n)>1 , so ( l 2 n , n ) > 1 (l^{2^n},n)>1 . However, this contradicts the condition that l 2 n 1 m o d n l^{2^n}\equiv 1\mod n . Hence, l = 1 l=1 , and n n is a prime.

By a classical theorem in number theory, n n has a primitive root g g , i.e. the order of g g mod n n is n 1 n-1 . Since 2 n > n 1 2^n>n-1 , and g 2 n 1 m o d n g^{2^n}\equiv 1\mod n , we must have n 1 2 n n-1|2^n . Therefore, n = 2 r + 1 n=2^r+1 for some integer r r . If r r has an odd factor, the expression factors, so n n is not a prime. Therefore, r r is also a power of 2, so n n is a prime of the form 2 2 k + 1 2^{2^k}+1

This is a prime if k = 0 , 1 , 2 , 3 , 4 k=0,1,2,3,4 . When k = 5 k=5 , it is divisible by 641, and if k k is higher, n n is greater than 1 0 10 10^{10} . Therefore, N = 3 + 5 + 17 + 257 + 65537 = 65819 N=3+5+17+257+65537=65819

All submitted solutions were essentially correct, using the primitive root theorem (= cyclicity of the multiplicative group) or some equivalent statement. There is really no way to do the problem by hand in a reasonable amount of time; however the list of the Fermat primes is well known.

Calvin Lin Staff - 7 years ago

Let us define another series y n , m = x n , m + 1 y_{n,m} = x_{n,m}+1 , so we get y 0 , m = m + 1 y_{0,m} = m+1 and y i + 1 , m = y_{i+1,m} = x i + 1 , m + 1 = x i , m 2 + 2 x i , m + 1 x_{i+1,m}+1 = x_{i,m}^2 + 2x_{i,m} + 1 = ( x i , m + 1 ) 2 = (x_{i,m}+1)^2 = y i , m 2 = y_{i,m} ^2 . From this we can directly get y n , m = y 0 , m 2 n y_{n,m} = y_{0,m} ^{2^n} and thus x n , m + 1 = ( m + 1 ) 2 n x n , m = ( m + 1 ) 2 n 1 x_{n,m} +1 = (m+1) ^{2^n} \Rightarrow x_{n,m} = (m+1)^{2^n} - 1

Now, it is given that n x n , m n ( m + 1 ) 2 n 1 1 m n 2 n \mid x_{n,m} \Rightarrow n \mid (m+1)^{2^n} - 1 \forall 1 \le m \le n-2 , or it can be stated as n i 2 n 1 2 i n 1 n \mid i^{2^n} - 1 \forall 2 \le i \le n-1 Now, let's assume n n is not a prime. Then let d n 1 d \le n-1 be a divisor of n n . From n d 2 n 1 n \mid d^{2^n} - 1 we get that d 2 n 1 = n k = d k d^{2^n} - 1 = nk = dk' for some integer k > 1 k' > 1 , but then k 1 k' \mid 1 , a contradiction. So n n is a prime.

As n n is a prime, there exists a primitive root modulo n n . Let it be x x .We get from n i 2 n 1 2 i n 1 n \mid i^{2^n} - 1 \forall 2 \le i \le n-1 that n x 2 n 1 n \mid x^{2^n} - 1 , and from Fermat's last theorem, n x n 1 1 n \mid x^{n-1} - 1 . As x x is a primitive root, we get that n 1 2 n n-1 \mid 2^n . So, n 1 = 2 t n-1 =2^t for some t t , or n n is a prime of the form 2 t + 1 2^t+1 .

Now if t t had a odd divisor, let it be a a . Then 2 a + 1 ( 2 a ) t / a + 1 = 2^a+1 \mid (2^a)^{t/a} +1= 2 t + 1 2^t+1 \Rightarrow 2 a + 1 n 2^a+1 \mid n , which is a contradiction as n n is a prime. So, t t has no odd divisor, which implies t = 2 x t = 2^x for some x x , and thus n n is a prime of the form 2 2 x + 1 2^{2^x} +1 , which means n n is a Fermat prime.

Now the only known Fermat prime (and only the ones less than or equal 1 0 10 10^{10} ) are 3 , 5 , 17 , 257 , 65537 3,5,17,257,65537 . So n n can be only 3 , 5 , 17 , 257 , 65537 3,5,17,257,65537 , and thus N = 3 + 5 + 17 + 257 + 65537 = 65819 N = 3+5+17+257+65537 =65819 , and thus the last 3 digits of N N is 819 819 , and thus our answer is 819 819 .

Stephen Lee
May 20, 2014

Throughout this solution, let's use the notation a n b a \equiv_n b to denote the congruence a b a \equiv b (mod n n ).

First, let's figure out exactly what the recurrence relation tells us. Completing the square gives us

x i + 1 , m = x i , m 2 + 2 x i , m = ( x i , m + 1 ) 2 1 x_{i+1,m} = x_{i,m}^2 + 2x_{i,m} = (x_{i,m}+1)^2-1 \; \; \; \; \; for i = 0 , 1 , 2 , i = 0,1,2,\ldots

So for any m m , a term in the sequence is computed by taking the previous term, adding 1, squaring, then subtracting 1. We find that the first few terms of the sequence will look like

{ m , ( m + 1 ) 2 1 , ( m + 1 ) 4 1 , ( m + 1 ) 8 1 , } \{m,(m+1)^2-1,(m+1)^4-1,(m+1)^8-1,\ldots\} .

We've discovered that x n , m = ( m + 1 ) 2 n 1 x_{n,m} = (m+1)^{2^n}-1 for all n n and m m . Using the change of variables k = m + 1 k=m+1 for ease of notation, we are thus tasked with finding all integers 3 n 1 0 10 3 \leq n \leq 10^{10} such that n ( k 2 n 1 ) n \mid (k^{2^n}-1) for all 2 k n 1 2 \leq k \leq n-1 . Equivalently, we require

k 2 n n 1 k^{2^n} \equiv_n 1 for all 2 k n 1 2 \leq k \leq n-1 .

We can narrow down the cases quickly. If n n is composite, say n = p q n=pq with p p prime and q > 1 q > 1 , then we necessarily require k 2 n p 1 k^{2^n} \equiv_p 1 . However, this fails for k = p k=p , which is certainly between 2 and n 1 n-1 . Thus n n must be prime.

Let n = p n = p be a prime number such that p 1 2 p p-1 \nmid 2^p , so 2 p = q ( p 1 ) + r 2^p = q(p-1)+r for some q Z q \in \mathbb{Z} and remainder 1 r p 2 1 \leq r \leq p-2 . We thus require that k q ( p 1 ) k r p 1 k^{q(p-1)}k^r \equiv_p 1 for all 2 k p 1 2 \leq k \leq p-1 . By Fermat's Little Theorem , since k q k^q is not divisible by p p (since 2 k p 1 2 \leq k \leq p-1 ), we know that k q ( p 1 ) p 1 k^{q(p-1)} \equiv_p 1 . Thus our required condition becomes

k r p 1 k^r \equiv_p 1 for all 2 k p 1 2 \leq k \leq p-1 , where 1 r p 2 1 \leq r \leq p-2 is fixed.

However, this condition implies that r λ ( p ) r \geq \lambda(p) , where λ \lambda is the Carmichael function . Carmichael's theorem gives us that since p p is prime, λ ( p ) = p 1 \lambda(p) = p-1 , contradicting the assumption that 1 r p 2 1 \leq r \leq p-2 . Thus, n n must be a prime p p such that p 1 2 p p-1 \mid 2^p . By setting r = 0 r = 0 in the recent argument, we see immediately that any such prime satisfies the desired condition!

Thus we seek all primes 3 p 1 0 10 3 \leq p \leq 10^{10} such that p 1 2 p p-1 \mid 2^p . To look for them, we note that such primes must satisfy p 1 = 2 q p-1 = 2^q for some q q . Equivalently, they must satisfy

p = 2 q + 1 p = 2^q +1 for some q q .

I claim that, since p 3 p \geq 3 is prime (so q 1 q \geq 1 ), such q q must be a power of 2. Suppose that q q has some odd factor r > 1 r > 1 , so q = r s q = rs , with s 1 s \geq 1 . Then

p = 2 q + 1 = ( 2 s ) r + 1 2 s + 1 ( 1 ) r + 1 = 0 p = 2^q+1 = (2^s)^r + 1 \equiv_{2^s+1} (-1)^r + 1 = 0 ,

implying 2 s + 1 p 2^s+1 \mid p , a contradiction since s < q s < q implies 2 s + 1 < p 2^s+1 < p .

Thus we conclude that we seek all primes 3 p 1 0 10 3 \leq p \leq 10^{10} such that p = 2 2 n + 1 p = 2^{2^n}+1 for some n n . Fortunately, we can recognize these numbers: they are known as the Fermat numbers , F n = 2 2 n + 1 F_n = 2^{2^n}+1 . Fermat had once falsely conjectured that all Fermat numbers are prime ( F 5 F_5 is composite, for example), but it is known that F 0 , F 1 , F 2 , F 3 , F_0, F_1,F_2,F_3, and F 4 F_4 are prime! As mentioned, F 5 F_5 is composite (so we don't want it), and F 6 > 1 0 10 F_6 > 10^{10} , so we finally arrive at our desired set of numbers: F 0 = 3 F_0=3 , F 1 = 5 F_1=5 , F 2 = 17 F_2=17 , F 3 = 257 F_3=257 , F 4 = 65537 F_4=65537 .

Adding these numbers up gives N = 65819 N = 65819 , from which we obtain the final three digits 819 .

Jimmy Kariznov
May 20, 2014

Note that x 0 , m + 1 = m + 1 x_{0,m}+1 = m+1 and x i + 1 , m + 1 = ( x i , m + 1 ) 2 x_{i+1,m}+1 = (x_{i,m}+1)^2 . By induction, it can be shown that x n , m + 1 = ( m + 1 ) 2 n x_{n,m}+1 = (m+1)^{2^n} , and so, x n , m = ( m + 1 ) 2 n 1 x_{n,m} = (m+1)^{2^n}-1 .

If n n is not prime, then pick an m = p 1 m = p-1 where p n p \mid n is prime. Then, x n , m = p 2 n 1 1 ( m o d p ) x_{n,m} = p^{2^n}-1 \equiv -1 \pmod{p} . So, p x n , m p \nmid x_{n,m} , and thus, n x n , m n \nmid x_{n,m} , a contradiction. Therefore, n n must be prime.

If x n , m 0 ( m o d n ) x_{n,m} \equiv 0 \pmod{n} , i.e. ( m + 1 ) 2 n 1 ( m o d n ) (m+1)^{2^n} \equiv 1 \pmod{n} for all 1 m n + 2 1 \le m \le n+2 with n n prime, then we need n 1 2 n n-1 \mid 2^n . Hence, n 1 = 2 r n-1 = 2^r , i.e. n = 2 r + 1 n = 2^r+1 for some integer r r .

It is well-known that if n = 2 r + 1 n = 2^r+1 is prime, then r r must be a power of 2 2 , i.e. r = 2 k r = 2^k and n = 2 2 k + 1 n = 2^{2^k}+1 for some non-negative integer k k .

If k 6 k \ge 6 then n = 2 2 k + 1 > 1 0 10 n = 2^{2^k}+1 > 10^{10} . Thus, we only need to check k 5 k \le 5 . For k = 0 , 1 , 2 , 3 , 4 , 5 k = 0,1,2,3,4,5 we have n = 3 , 5 , 17 , 257 , 65537 , 4294967297 n = 3, 5, 17, 257, 65537, 4294967297 , of which, the first five are prime, while 4294967297 4294967297 is divisible by 641 641 .

Therefore, N = 3 + 5 + 17 + 257 + 65537 = 65819 819 ( m o d 1000 ) N = 3+5+17+257+65537 = 65819 \equiv \boxed{819} \pmod{1000} .

"then we need n 1 2 n n-1 \mid 2^n " Here the structure theorem for multiplicative group is implicitly used.

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

[We will ignore the subscript m m .]

First, denote x i + 1 x_i+1 by y i y_i for all i i . Then x i + 1 = x i 2 + x i x_{i+1}=x_i^2+x_i is equivalent to y i + 1 = y i 2 . y_{i+1}=y_i^2. So y i = m 2 i , y_i=m^{2^i}, and x n = m 2 n 1 x_n = m^{2^n} -1 . If n n is not prime, then take take m n , m 1 m | n, m \neq 1 , we can see that m ∤ x n m \not \mid x_n , hence m ∤ x n m \not \mid x_n . Thus, we must have n n prime, which we will denote as p p for convenience.

Now note that 1 x 0 p 2 1\leq x_0\leq p-2 condition is equivalent to 2 y p 1 2\leq y \leq p-1 and p x p p|x_p is equivalent to y p 1 ( m o d p ) . y_p\equiv 1 \pmod p .

We will now prove two lemmas.

Lemma 1. Suppose p p is a prime number. Then m 2 p 1 m^{2^p}\equiv 1 for all m = 1 , 2 , . . . , p 1 m=1,2,...,p-1 if and only if p 1 p-1 is a power of 2 2 .

In one direction, if p 1 = 2 k , p-1=2^k, then clearly k p k\leq p . By the Fermat's theorem, for any m ≢ 0 ( m o d p ) , m \not \equiv 0 \pmod p, m 2 k 1 ( m o d p ) , m^{2^k}\equiv 1 \pmod p, so m 2 p 1 2 p k 1 ( m o d p ) . m^{2^p}\equiv 1^{2^{p-k}}\equiv 1 \pmod p.

In the other direction, we will give two proofs.

Proof #1. Suppose p 1 = 2 k n , p-1=2^k\cdot n, where n > 1 n>1 is odd. Because the multiplicative group of non-zero residues modulo prime p p is cyclic, there exists a residue m ≢ 1 ( m o d p ) , m \not \equiv 1\pmod p, such that m n 1 ( m o d p ) . m^n\equiv 1 \pmod p. Because 2 p 2^p and n n are coprime, there exists integer u u and v , v, such that u 2 p + v n = 1. u2^p+vn=1. Then m m u 2 p + v n 1 u 1 v 1 ( m o d p ) , m\equiv m^{u2^p+vn}\equiv 1^{u}\cdot 1^v \equiv 1 \pmod p, a contradiction.

Proof #2. Suppose p 1 = 2 k n , p-1=2^k\cdot n, where n > 1 n>1 is odd. Consider the polynomial with coefficients in the field of residues modulo p p : P ( x ) = x 2 k 1. P(x)=x^{2^k}-1. It can have no more than 2 k 2^k roots, and 2 k < p 1. 2^k<p-1. So there exists m ≢ 0 m\not \equiv 0 such that m 2 k ≢ 1 ( m o d p ) . m^{2^k}\not \equiv 1 \pmod p. For such m , m, by the Fermat's theorem, m 2 k n 1 ( m o d p ) . m^{2^k\cdot n}\equiv 1 \pmod p. If m 2 p 1 ( m o d p ) , m^{2^p}\equiv 1 \pmod p, then, because g . c . d . ( 2 k n , 2 p ) g.c.d.(2^k\cdot n,2^p) divides 2 k , 2^k, there exist integers u u and v , v, such that u ( 2 k n ) + v 2 p = 2 k . u(2^kn)+v2^p=2^k. Therefore, m 2 k 1 u 1 v 1 ( m o d p ) , m^{2^k}\equiv 1^u\cdot 1^v \equiv 1 \pmod p, a contradiction.

Lemma 2. If p = 2 k + 1 p=2^k+1 is prime, then either p = 2 p=2 or p = 2 2 j + 1 p=2^{2^j}+1 for some integer j 0. j\geq 0.

Proof. If p > 2 , p>2, then k 1. k\geq 1. If some odd number q q divides k , k, that is k = q r , k=qr, then 2 k + 1 = ( 2 r + 1 ) ( 2 r ( q 1 ) 2 r ( q 2 ) + . . . + 1 , ) 2^k+1=(2^r+1)(2^{r(q-1)}-2^{r(q-2)}+...+1,) so p p is not prime.

With the above two lemmas, it is enough to find the prime numbers of the form p = 2 2 j + 1 , p=2^{2^j}+1, for p < 1 0 10 . p<10^{10}. This means 0 j 5. 0\leq j \leq 5. For 0 j 4 0\leq j\leq 4 these numbers are indeed prime: 3 , 5 , 17 , 257 , 65537. 3,\ 5,\ 17,\ 257, \ 65537. For j = 5 j=5 , however, 2 2 5 + 1 2^{2^5}+1 is divisible by 641. 641. So the sum is 3 + 5 + 17 + 257 + 65537 = 65819 3+5+17+257+65537=65819 and the answer is 819. 819.

As you can see, not all numbers of the form 2 2 j + 1 2^{2^j}+1 (called Fermat numbers) are prime. In fact, they are known to be prime for 0 j 4 0\leq j \leq 4 and composite for 5 j 11 5\leq j\leq 11 . Not much is known beyond that, and while some heuristic arguments suggest that there are infinitely many Fermat primes, other arguments suggest that 2 2 4 + 1 2^{2^4}+1 may be the last one.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...