Difference between a square and a power of 2

How many positive integers n 10000 n\leq 10000 are there such that 7 2 n n 2 7 | 2^n - n^2 ?

Note: ' | ' means 'divides'.


The answer is 2858.

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.

1 solution

We need to look for where the modulo 7 7 "cycles", (if any), for both the sequences 2 n 2^{n} and n 2 n^{2} correspond.

For the 2 n 2^{n} sequence we note that 2 n + 3 = 8 2 n 2 n ( m o d 7 ) 2^{n + 3} = 8*2^{n} \equiv 2^{n} \pmod{7} since 8 1 ( m o d 7 ) . 8 \equiv 1 \pmod{7}. So the modulo 7 7 cycle here has length 3 3 , and proceeds as 2 , 4 , 1 , 2 , 4 , 1 , 2 , 4 , 1 , . . . . . 2,4,1,2,4,1,2,4,1,.....

For the n 2 n^{2} sequence, we first note that, since ( n + 7 ) 2 n 2 ( m o d 7 ) , (n + 7)^{2} \equiv n^{2} \pmod{7}, the maximum length of any modulo 7 7 cycle will be 7. 7. Since the actual cycle proceeds as 1 , 4 , 2 , 2 , 4 , 1 , 0 , 1,4,2,2,4,1,0, we see that this cycle does indeed have length 7. 7.

The modulo 7 7 cycle for 2 n n 2 2^{n} - n^{2} will then have length l c m ( 3 , 7 ) = 21 , lcm(3,7) = 21, and proceeds as

1 , 0 , 6 , 0 , 0 , 0 , 2 , 3 , 4 , 0 , 2 , 4 , 1 , 4 , 0 , 5 , 2 , 6 , 5 , 3 , 1. 1,0,6,0,0,0,2,3,4,0,2,4,1,4,0,5,2,6,5,3,1.

Thus for every successive sequence of 21 21 integers starting at n = 1 n = 1 there are a total of 6 6 instances where 7 ( 2 n n 2 ) . 7|(2^{n} - n^{2}).

Now since 10000 = 476 × 21 + 4 , 10000 = 476 \times 21 + 4, and since of the first 4 4 values in this last cycle there are 2 2 instances where 7 ( 2 n n 2 ) , 7|(2^{n} - n^{2}), the answer to this question is 476 × 6 + 2 = 2858 . 476 \times 6 + 2 = \boxed{2858}.

Same solution as I had thought of. ¨ \ddot\smile

Nihar Mahajan - 6 years ago

Log in to reply

Nice question, Nihar. :)

Brian Charlesworth - 6 years ago

@Brian Charlesworth Sir, The solution is not Properly L a T e X LaTeX ed. Kindly Check it.

Although, I understood it! Great solution. I proceeded As per the Modulo cycle rule, But I could not go further. Thanks for explaining it to me. :D

Mehul Arora - 6 years ago

Log in to reply

I'm glad it made sense to you. :) As for the Latexing, it looks fine on my screen. I've written a lot of solutions, and to my eye this looks on par with the Latexing in my previous solutions. What specific concerns did you have?

Brian Charlesworth - 6 years ago

Log in to reply

Ohh, It's nothing now. Earlier, It was only the Coding. Maybe it was a fault on my screen.

And yeah, You are indeed the solution master.

Mehul Arora - 6 years ago

Log in to reply

@Mehul Arora Haha. Thanks! Yeah, my screen does some crazy things with coding every once in a while too, but fortunately it never lasts for long. :)

Brian Charlesworth - 6 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...