LLG's blog

By LLG, history, 4 weeks ago, In English,

How to find the smallest perfect square which is a concatenation of the same number two times ?

 
 
 
 
  • Vote: I like it
  • -13
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

$$$0^2 = 0 = 00$$$

»
4 weeks ago, # |
  Vote: I like it +19 Vote: I do not like it

1322314049613223140496=36363636364^2

»
4 weeks ago, # |
Rev. 2   Vote: I like it +12 Vote: I do not like it

Suppose the number is $$${m}$$$. Then $$${mm}$$$ is a perfect square.

$$${mm}={m}*{(10^{n}+1)}$$$

Note that the number of digits in $$${m}$$$ should be less than or equal to $$${n}$$$. Thus,

$$${(10^{n}+1)}\gt{m}$$$

We can now look at the prime factorisation of $$${(10^{n}+1)}$$$. If any prime factor has frequency more than $$${1}$$$, then we can remove that prime factor in pairs until its number of occurrences is either $$${0}$$$ or $$${1}$$$. Having done so we are left with the smallest possible $$${m}$$$. Multiplying the two will give us the smallest $$${mm}$$$.

Naive Python Solution

This gives $$${mm}={82644628100826446281}$$$ assuming $$${m}$$$ can contain leading zeroes.

Edit :
We can also solve this for $$${m}$$$ without leading zeroes. Using the previous solution we can get the smallest $$${n}$$$ for which $$${(10^{n}+1)}$$$ contains a prime factor with exponent more than $$${1}$$$ (i.e. $$${n} = {11}$$$ and there is only one prime factor which is $$${11}$$$ with exponent $$${2}$$$). First, we have to remove some prime factor pairs from $$${(10^{n}+1)}$$$ because we need $$${m}$$$ smaller than $$${(10^{n}+1)}$$$. We have only one option of removing $$${11}^{2}$$$ here. Now our number is $$${826446281}$$$. We have to multiply this number with perfect squares(i.e. $$${2}^{2}, {3}^{2}, ... $$$) until our number becomes $$${11}$$$ digit. Our final $$${m}$$$ is $$${826446281}*({4}^{2}) = {13223140496}$$$ thus, $$${mm}$$$ is $$${1322314049613223140496}$$$.