Given

Hexagon is super secret system with varying levels of access. Users do not have to remember any password. They just have to answer the questions posed by Hexagon strictly in the allotted time.

Today TOM ( he wanted to sneak in his handle in this problem ) needs top level access by answering this seemingly toughest question without access to any computers.

$$\text{Question Posed by Hexagon}$$

Concatenate 89 eighty nine times(8989....8989) Square it. Input the 277th, 325th,351st digit of the result under three minutes. Maximum of three attempts allowed for input with two minute grace period.

Tom is not terrified. He knows this is not a trick question. Input digits need to be quickly calculated and taken from the 356 digit product. He scribbled few simple calculations on his notepad and entered the three digits.

$$\text{ACCESS Granted}$$ To TOM on his first attempt.

Figure out his method and how TOM tackled toughest problem posed by Hexagon to date.

• tom is scratching his head...
– tom
May 20 '19 at 9:56
• @Uvc Did he get it right the first time? May 20 '19 at 10:03
• @rhsquared....lot of.appropriate square questions for you..SAD is std phrase displayed prior to Hexagons access ...Terrific Tom got it in his first attempt
– Uvc
May 20 '19 at 10:11
• Will let you know after all the answers are in.
– Uvc
May 20 '19 at 10:30
• Key thing to realize is multipying large numbers becomes very easy if you work with compliments. For at least right half of the answer.....squaring of 898989...8989...is exactly same as squaring corresponding compliment....10101010....10101011 which is so simple .Especially, if you use duplex method which is amenable to mental math ,an answer can be written in one step..
– Uvc
May 21 '19 at 21:51

I found that

$$89^2 = 79 |21$$ $$8989^2 = 80 \ 80 |21 \ 21$$ $$898989^2 = 80 \ 81\ 81 |22 \ 21 \ 21$$ $$89898989^2 =80 \ 81 \ 82 \ 82 |23 \ 22 \ 21 \ 21$$

And,

no. of digits with $$n$$ 89's = $$4n$$  no. of 2 digit pairs = $$2n$$  Last 4 digits = $$2121$$  First 2 digits = $$80$$

So by following the pattern

351st digit = 2 (6th digit from last)  $$356 - 325 = 31 = 2(15) + 1$$ , so, for 325th digit - 15th pair from last is 34. ($$326 = 4, 325 = 3$$)The required number is 3 So, it is 3  $$356 -277 = 79 = (39)2+ 1$$, and 39th pair from last is 58($$278 = 8,277 = 5$$) so it is 5  Thus, 277th digit is 5, 325th digit is 3 and 351st digit is 2

I found out that

By concatenating 89 thirty times then squaring it,
$${\underbrace{(898989...898989)}_{\text{30 times}}}^2$$ $$= \text{80 81 82 83 84 ... 94 95 96 97 99 00 01 02 ... 07 08 09 08 |}$$ $$\text{ 49 48 47 46 45 ... 25 24 23 22 21 21}$$
Last 2 digits: $$21$$
$$x$$-th to last digit if $$x$$ is odd: $$\text{mod}(\frac{x-1}2,10)$$ (mod(a,b) = remainder if a/b)
$$x$$-th to last digit if $$x$$ is even: $$2+\lfloor\frac{x-2}{20}\rfloor$$
The rest of the information here isn't needed, I'll explain it in the last part.

And I also found out that

To find the length of 89 concatenated n times, $$\text{length}(89^2) = 4$$ $$\text{length}(8989^2) = 8$$ $$\text{length}(898989^2) = 12$$ $$\text{length}(89898989^2) = 16$$
$$\text{length}({\underbrace{898989...898989}_{x\text{ times}}}^2) = x * 4$$

So

Length of digit: $$\text{length}({\underbrace{898989...898989}_{\text{89 times}}}^2) = 356$$ $$356/2 = 178 \rightarrow$$ This implies the first half of the digit will not be used, since the question is asking for the 277th, 325th, and the 351st digit.

277th digit = (356 - 277 + 1)th to last digit = 80th to last digit
$$80$$th to last digit: $$2+\lfloor\frac{80-2}{20}\rfloor$$ $$=2+\lfloor\frac{78}{20}\rfloor$$ $$=2+3$$ $$\text{80th to last digit (277th digit)}=5$$
325th digit = (356 - 325 + 1)th to last digit = 32th to last digit
$$32$$th to last digit: $$2+\lfloor\frac{32-2}{20}\rfloor$$ $$=2+\lfloor\frac{30}{20}\rfloor$$ $$=2+1$$ $$\text{32th to last digit (325th digit)}=3$$

351th digit = (356 - 351 + 1)th to last digit = 6th to last digit
$$6$$th to last digit: $$2+\lfloor\frac{6-2}{20}\rfloor$$ $$=2+\lfloor\frac{4}{20}\rfloor$$ $$=2+0$$ $$\text{6th to last digit (351th digit)}=2$$

Therefore the digits Tom entered are:

5, 3, and 2.

• and you found all this without a computer? wowser! May 20 '19 at 10:59