A number theory problem by A Former Brilliant Member

Find the sum of all positive integers whose squares are of the form A B A B A \overline {ABABA} , a five digit number with A A and B B as digits.


The answer is 264.

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.

3 solutions

Chris Lewis
May 21, 2019

There are only 90 90 numbers of the form n = A B A B A n=\overline{ABABA} , so it's easy to check all of these with a few lines of code; however, we can narrow down the possibilities a bit, and actually solve this by hand.

The last digit of a square must be one of 0 , 1 , 4 , 5 , 6 , 9 0,1,4,5,6,9 , so A A is one of these. We can eliminate A = 0 A=0 as this would not give a five-digit number.

Now note that n = 10101 A + 1010 B n=10101A+1010B , and that 3 3 , 7 7 and 13 13 are all factors of 10101 10101 .

n 2 B ( m o d 3 ) n \equiv 2B \pmod3 . All squares are congruent to either 0 0 or 1 ( m o d 3 ) 1 \pmod3 , so this means B { 0 , 2 , 3 , 5 , 6 , 8 , 9 } B \in \left\{ 0,2,3,5,6,8,9 \right\} .

Likewise, n 2 B ( m o d 7 ) n \equiv 2B \pmod7 . All squares are congruent to either 0 0 , 1 1 , 2 2 or 4 ( m o d 7 ) 4 \pmod7 , so this means B { 0 , 1 , 2 , 4 , 7 , 8 , 9 } B \in \left\{ 0,1,2,4,7,8,9 \right\} .

By looking at quadratic residues ( m o d 13 ) \pmod{13} we find that B { 0 , 1 , 3 , 4 , 9 } B \in \left\{ 0,1,3,4,9 \right\} .

Checking which numbers are in all of these sets, we find B { 0 , 9 } B \in \left\{ 0,9 \right\} .

If the last digit of a square is 5 5 , its penultimate digit must be 2 2 ; but this isn't an option for B B , so we have A { 1 , 4 , 6 , 9 } A \in \left\{ 1,4,6,9 \right\} .

This only leaves eight possibilities; we can reduce these even further by looking at each of them ( m o d 8 ) \pmod8 (the quadratic residues are 0 , 1 , 4 0,1,4 ). This only leaves two viable options, 40404 40404 and 69696 69696 . But 40404 = 4 10101 40404=4\cdot10101 and 10101 5 ( m o d 8 ) 10101 \equiv 5 \pmod8 , so 40404 40404 is not a square.

Finally there is only one possibility, 69696 69696 ; checking this we find it is the square of 264 \boxed{264} .

Nice solution.

Kyle T
May 21, 2019
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
$t = 0;
for($a=1;$a<=1000;$a++){
    $a2 = pow($a,2);
    $arr = str_split($a2);
    if(strlen($a2)==5 && $arr[0]==$arr[2] && $arr[0]==$arr[4] && $arr[1]==$arr[3]){
        echo $a.' '.$a2.'<br>';
        $t+=$a;
    }
}
echo 'answer: '.$t;exit;
?>
/* 
prints: 
264 69696
answer: 264
*/

It turns out that A can be 0 without that affecting the result as the only square with A being 0 is 0.

0, 1010, 2020, 3030, 4040, 5050, 6060, 7070, 8080, 9090, 10101, 11111, 12121, 13131, 14141, 15151, 16161, 17171, 18181, 19191, 20202, 21212, 22222, 23232, 24242, 25252, 26262, 27272, 28282, 29292, 30303, 31313, 32323, 33333, 34343, 35353, 36363, 37373, 38383, 39393, 40404, 41414, 42424, 43434, 44444, 45454, 46464, 47474, 48484, 49494, 50505, 51515, 52525, 53535, 54545, 55555, 56565, 57575, 58585, 59595, 60606, 61616, 62626, 63636, 64646, 65656, 66666, 67676, 68686, 69696, 70707, 71717, 72727, 73737, 74747, 75757, 76767, 77777, 78787, 79797, 80808, 81818, 82828, 83838, 84848, 85858, 86868, 87878, 88888, 89898, 90909, 91919, 92929, 93939, 94949, 95959, 96969, 97979, 98989 and 99999 are the five digit numbers in the prescribed format with A being 0. The only squares in that list are 0 and 69696.

Moderator: The question posed by Alak B does not fit the answer.The answer is confusing and unhelpful.

E Koh - 2 years ago

I beg to differ. The only unclarity is whether A could be 0. The language is such that A probably may not be allowed to 0. It turns out that even if A were permitted to be 0, the same answer results. The problem clearly requests the sum of positive integers whose squares are of the required A B A B A \overline{ABABA} form.

Your complaint is more properly done using a report.

Randolph Herber: Are you a moderator?

E Koh - 2 years ago

No, I am not a moderator.

To submit a report, in the lower right corner of the problem is "... More". Click that. A pop-up that says "View reports" should come up. Click that. At that point, you can enter a report.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...