Squaring Preserves Digits

Consider all 2 digit numbers N N such that the last 2 digits of N 2 N^2 are N N itself. What is the sum of all these 2 digit numbers?

Details and assumptions

The number 12 = 012 12 = 012 is a 2-digit number, not a 3-digit number.


The answer is 101.

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.

6 solutions

Sanada Yukimura
May 20, 2014

According to assumption, N 2 N = N ( N 1 ) N^2-N=N(N-1) has the last two digits equally zero, hence is divisible by 100. Since N N and N 1 N-1 are coprime, it follows that one of them must be divisible by 25, and one of them must be divisible by 4. We consider the following cases:

Case 1: N N is a multiple of 25 and 4. This has no 2-digit solution.

Case 2: N N is a multiple of 25, N 1 N-1 is a multiple of 4. The solution is N = 25 N=25 .

Case 3: N N is a multiple of 4, N 1 N-1 is a multiple of 25. The solution is N = 76 N=76 .

Case 4: N 1 N-1 is a multiple of 25 and 4. This has no 2-digit solution.

Hence, the answer is 101.

This solution actually uses the Chinese Remainder Theorem, since we know that remainders of N N or N 1 N-1 taken modulo 25 and 4. In fact, we may easily use a similar method to find k k- digit numbers N N such that the last 2 digits of N 2 N^2 are N N itself. Furthermore, for fixed k k , do you know what the sum of all such numbers are?

Calvin Lin Staff - 7 years ago
Shefali Nayak
May 20, 2014

Let N be 10X+Y , where X and Y represent the two digits of N . The units digit of N^2 is only affected by Y, the units digit of N. In other words, Y 2 Y ( m o d 10 ) Y^2 \equiv Y \pmod{10} This is only true for three digits: 1, 5 and 6. We can deal with each case separately. When Y is 1, N 2 = ( 10 X + 1 ) 2 = 100 X 2 + 20 X + 1 N^2=(10X+1)^2=100X^2+20X+1 Rearranging in order to see multiples of 100, 10, and 1 will make the values of the digits clearer: 100 ( X 2 ) + 10 ( 2 X ) + ( 1 ) 100(X^2)+10(2X)+(1) The first term is a multiple of 100, and therefore it will not affect anything less than the hundreds digit. Since the second term is a multiple of 10, it will affect the tens digit (and possibly the hundreds digit as well, but that is irrelevant to the question asked). We want the tens digit to be X, which means 2 X X ( m o d 10 ) 2X \equiv X \pmod{10} There is no solution to this statement, so Y cannot equal 1. Let's look at the second case, where Y=5: ( 10 X + 5 ) 2 = 100 X 2 + 100 X + 25 (10X+5)^2=100X^2+100X+25 100 ( X 2 + X ) + 10 ( 2 ) + 5 100(X^2+X)+10(2)+5 The 10(2) term shows that the tens digit must be 2, regardless of the value of X. To satisfy the conditions for N, this means that X must be 2. This gives us 25 as a value of N. For the third case, when Y=6, ( 10 X + 6 ) 2 = 100 X 2 + 120 X + 36 (10X+6)^2=100X^2+120X+36 100 ( X 2 + X ) + 10 ( 2 X + 3 ) + 6 100(X^2+X)+10(2X+3)+6 Like in the first case, modulo arithmetic can be used to write an equation for the tens digit: 2 X + 3 X ( m o d 10 ) 2X+3 \equiv X \pmod{10} X 3 7 ( m o d 10 ) X \equiv -3 \equiv 7 \pmod{10} Therefore, when Y=6, X must be 7, giving us 76 as a value for N. All three possible cases were covered, resulting in 2 possible values for N. Adding those two values of N together, we get the answer: 25 + 76 = 101 25+76=101

Emanuel Perez
May 20, 2014

The number has to end in either 0,1,5, or 6, since those are the only number s when squared are congruent mod 10 (or have the same last digit). We can toss out zero because then the square would end in two zeros which would mean that the original number was 0. Working mod 100, express the two digit number xy as 10x+y. Its square mod 100 is 20x y+y^2. You want to find all (x,y) such that 20x y+y^2 is congruent to 10x+y mod 100. Substituting y=1, y=5,y=6 gives you that the only possible solutions are (x,y)=(2,5), (7,6), so the sum is 25+76=101.

Wei Liang Gan
May 20, 2014

$$\text{Firstly, as the last digits are the same} N^2 \equiv N \pmod{10}$$ $$N^2-N=N(N-1) \equiv 0 \pmod{10}$$ $$\text{Prime factorisation of 10 is } 2 \times 5$$ $$N(N-1)\text{ is clearly even so it is only required that } N(N-1) \equiv 0 \pmod{5}$$ $$\Rightarrow N \equiv 0,1 \pmod{5}$$ $$\Rightarrow N = 10k+1,10k+5,10k+6 \text{ where } k<10 \text{ as N is 2-digit}$$

$$\text{Case 1: } N=10k+1$$ $$(10k+1)^2 \equiv 10k+1 \pmod{100}$$ $$100k^2 + 20k + 1 \equiv 10k + 1 \pmod{100}$$ $$10k \equiv 0 \pmod{100} \text{ which is clearly impossible if }k<10$$

$$\text{Case 2: } N=10k+5$$ $$(10k+5)^2 \equiv 10k+5 \pmod{100}$$ $$100k^2 + 100k + 25 \equiv 10k + 5 \pmod{100}$$ $$25 \equiv 10k+5 \equiv N \pmod{100} \Rightarrow N = 25$$

$$\text{Case 3: } N=10k+6$$ $$(10k+6)^2 \equiv 10k+6 \pmod{100}$$ $$100k^2 + 120k + 36 \equiv 10k + 6 \pmod{100}$$ $$10k + 30 \equiv 0 \equiv N \pmod{100} \Rightarrow k = (100-30)/10 = 7\text{ and }N = 10(7) + 6 = 76$$

Therefore, total is 76+25 = 101

Harshit Kapur
May 20, 2014

Any 2 digit number is of the form 10 a + b 10a + b , where a a and b b are its tens and units digits respectively.

Now for the last 2 digits of the number's square to be equal to the number, the last digit definitely has to be equal.

Only numbers ending with 1, 5, 6, and 9 exhibit this property.

So we have limited our search to only 40 numbers from 90.

Now let us try further.

If ( 10 a + b ) 2 m o d 100 = 10 a + b (10a + b)^2 mod 100 = 10a + b , then ( 100 a 2 + 20 a b + b 2 ) m o d 100 = 10 a + b (100a^2 + 20ab + b^2) mod 100 = 10a + b

Now whatever out first digit ( a a ) is, 100 a 100a will never affect the first 2 digits.

So we are left with ( 20 a b + b 2 ) m o d 100 = 10 a + b (20ab + b^2) mod 100 = 10a + b

Now we substitute b = 1 b = 1 , to get ( 20 a + 1 ) m o d 100 = 10 a + 1 (20a + 1) mod 100 = 10a + 1 , or ( 20 a ) m o d 100 = 10 a (20a) mod 100 = 10a

Clearly, no value of a a suffices the above condition.

Now we come to the case with b = 5 b = 5 . The condition to be satisfied is ( 100 a + 25 ) m o d 100 = 10 a + 5 (100a + 25) mod 100 = 10a + 5 25 = 10 a + 5 a = 2 \Rightarrow 25 = 10a + 5 \Rightarrow a = 2 (again, for all values of a , 100 a a, 100a won't affect the last 2 digits)

So we have 25 25 as one possible solution.

Now consider the case where units digit is 6 6 . ( 120 a + 36 ) m o d 100 = 10 a + 6 120 a m o d 100 + 30 = 10 a (120a + 36) mod 100 = 10a + 6 \Rightarrow 120a mod 100 + 30 = 10a We start checking from a = 4 a = 4 , and find that a = 7 a = 7 satisfies.

So we set 76 76 as another solution.

Now similarly, we check by setting a = 9 a = 9 , and find that no numbers satisfy.

So the answer is 25 + 76 = 101 25 + 76 = 101

Calvin Lin Staff
May 13, 2014

Since the last 2 digits of N 2 N^2 are N = a b N=\overline{ab} , then the last 2 digits of N 2 N N^2-N are 00 \overline{00} , so 100 divides N 2 N = N ( N 1 ) N^2-N=N(N-1) . Since gcd ( N , N 1 ) = 1 \gcd(N, N-1) = 1 , both terms cannot be divisible by 2 or 5 at the same time. As such, we must have N 0 ( m o d 4 ) , N 1 ( m o d 25 ) N\equiv 0 \pmod{4}, N\equiv 1 \pmod{25} or N 1 ( m o d 4 ) , N 0 ( m o d 25 ) N \equiv 1 \pmod{4}, N \equiv 0 \pmod{25} or N 0 ( m o d 100 ) N \equiv 0 \pmod{100} or N 1 ( m o d 100 ) N\equiv 1 \pmod{100} .

Case 1: N 0 ( m o d 4 ) , N 1 ( m o d 25 ) N\equiv 0 \pmod{4}, N\equiv 1 \pmod{25} . This has the unique solution N 76 ( m o d 100 ) N \equiv 76 \pmod{100} .

Case 2: N 1 ( m o d 4 ) , N 0 ( m o d 25 ) N \equiv 1 \pmod{4}, N \equiv 0 \pmod{25} . This has the unique solution N 25 ( m o d 100 ) N \equiv 25 \pmod{100} .

Case 3: N 0 ( m o d 100 ) N \equiv 0 \pmod{100} . This has no solution that has 2 digits.

Case 4: N 1 ( m o d 100 ) N \equiv 1 \pmod{100} . This has no solution that has 2 digits.

Hence, the sum of all 2 digit numbers are 76 + 25 = 101 76+25 = 101 .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...