# Hexagon vs Harry Houdini…Round 1…How did Harry do? Let us Find out

$$Given:$$

Harry Houdini is Mental Math Magician and top Math Wizard at Hexon..one of the top cryptographic companies in the world.

They have deployed Passwordless super smart secret system to control employee access. Top Tier employees get top-notch questions to be answered in allotted time prior to be granted access.

Harry met Hexagon for the first time today as it is his first day of work. Hexagon has designed couple of tough questions for him to test his mettle. Little did the system know..it is in for a nasty surprise!!!

$$Question 1: Time..2 mts$$

For a Full Reptend Prime of the type RPP (concatenated number with R,P..2 distinct digits), sum of digits is 22. Last 2 and first 20 digits of its period in the reciprocal need to be inputted.

$$Question 2: 3 mts$$

Concatenated number is 177 digits long with 88 eighty eights followed by 9(last digit). Square it and input the last 30 digits of the result.

Harry said this is insult to me. Haven’t you heard of my mental math wizardry before?

Harry told Hexagon..please activate voice input option and I will rattle off all the necessary digits $$under 60 seconds$$

Tell me : $$How Harry Did It?$$

• Can you give the defintion (or a link to a definition) of a Reptand Prime ? Google doesn't give immediate answer. – Evargalo May 21 at 13:25
• Sure...go to...oeis.org...in search...type in Reptand prime – Uvc May 21 at 15:05
• By "reptand prime" I think Uvc means "full reptend prime". The "full" is actually an essential part of the name; a full reptend prime is a prime p for which the decimal expansion of 1/p has repeating period p-1 digits long (the longest it can be). – Gareth McCaughan May 21 at 15:14
• I am really surprised by 2 downvotes on this puzzle. I would like to improve and even annoynomous response for reasons most welcome. With the right knowledge and codes, what Harry has done can be done by anybody. That is the knowledge I am trying to convey and transfer. – Uvc May 21 at 17:17
• Having said that, some possible reasons for downvotes: 1) when a key detail in a puzzle is stated incorrectly, making it inaccessible to some, you may get frustration downvotes (i.e. "reptand prime" when "full reptend prime" was probably needed). 2) you've been posting a lot of math-heavy puzzles (some light on puzzle and heavy on maths and domain search), which can lead to genre fatigue—people tired of seeing too much of one thing stop upvoting, and eventually start downvoting. 3) valid solutions are valid even if they're not the specific "simplest" solution path you have in mind. – Rubio May 22 at 6:36

Question 2:

Consider that:

$$N=$$"88 eighty eights followed by 9"$$=10^{177}-111...111$$
where the last number, $$M=111...111$$, has $$177$$ digits.
Using $$(a-b)^2=a^2-2ab+b^2$$, we can understand that the last 30 digits (and even, the last 177 ones) of $$N^2$$ are identical to the last digits of $$M^2$$. Indeed, the other terms are multiples of $$10^{177}$$ and thus they end with 177 zeroes.

Then

Numbers like $$M$$ (known as repunits) show funny patterns when squared; for instance:
$$111111111^2=12345678987654321$$
It gets a little trickier when they are longer than 10 digits because of the carry overs, and in particular when they are 177 digits long.

The 9 first carry overs are $$0$$, the 9 next ones are $$1$$, then 9 $$2$$, then $$3$$'s, etc... Taking them into account, the last thirty digits of $$M^2$$, and also of $$N^2$$, are:
$$320$$,$$987$$,$$654$$,$$320$$,$$987$$,$$654$$,$$320$$,$$987$$,$$654$$,$$321$$

Question 1:

A "full reptend prime" is a prime p for which the decimal expansion of 1/p has its full length of p-1 digits (rather than a proper divisor of p-1). The only one of form RPP with R+P+P=22 is 499. Then we want the first 20 and last 2 digits of that repeating period. The first 20 will look like this: 002 004 008 016 032 064 128. (We don't need the final "8".) For the last two, note that "multiplying by 1000 = multiplying by 2", so that repeating period must end 001. (We don't need the initial "0".)

• How do I assign the vote. Each of you got one part right. – Uvc May 21 at 17:40
• Any way you like! (Some obvious options: 1. Give the tick to whoever did the part you think is hardest. 2. Give the tick to whoever explained things best. 3. Give the tick to whoever solved the last bit because apparently that was hardest. 4. Give the tick to whoever has less rep, in the name of egalitarianism. 5. Choose at random.) – Gareth McCaughan May 21 at 18:36
• Thx..you don’t need any more recognition...I tossed the coin and going with 4...thx for clarification on full reptend...I have used it loosely – Uvc May 21 at 18:39
• Thx for the thick. To prevent such dilemmas in the future, you might want to place puzzles in different questions when you have several ones. – Evargalo May 22 at 11:37
• Agreed..I thought it was logical to combine..didn’t anticipate this kind of dilemma... – Uvc May 23 at 10:20