# Why can an integer written $2$ times in a row never be a perfect square?

It seems to be true for all natural numbers below $1,000,000$. I am really stuck any kind of help will be appreciated!

This is not true in general.

Here is a counterexample: 4049586776940495867769 is the square of 63636363637

Why did I have to come up with such a huge counterexample? The reason is that the "conjecture" indeed works for small numbers. Here is why : Consider $\overline{NN}$ where $N$ is a $d$-digit number so that $\overline{NN}$ has $2d$ digits. $\overline{NN} = N \times (10^d+1)$. If $10^d+1$ is squarefree, $\overline{NN}$ has to be at least $(10^d+1)^2$ which has more than $2d$ digits, a contradiction. Thus we need $10^d+1$ to be the multiple of the square of some prime for $\overline{NN}$ to have the possibility of being a perfect square. $d=11$ is the smallest value for which this works.

That happens just because $10^n+1$ is squarefree for small $n$s. However, $10^{11}+1$ is not squarefree, so we can just take its square-free part, $23\cdot 4093\cdot 8779=826446281$, multiply it by some square till it reaches eleven digits, $$16\cdot 23\cdot 4093\cdot 8779 = 13223140496$$ then append this number to itself, getting a square: $$1322314049613223140496 = 2^{4}\cdot 11^{2}\cdot 23^2\cdot 4093^2\cdot 8779^2.$$

This is not true, though the conjecture is very plausible, as the smallest counterexample is 22 digits long (so, an 11-digit number repeated). These numbers are the content of OEIS A092118, and the first such numbers are:

$$1322314049613223140496, 2066115702520661157025, 2975206611629752066116, 4049586776940495867769, 5289256198452892561984, 6694214876166942148761, 8264462810082644628100, 183673469387755102041183673469387755102041.$$

The observation that the number given by concatenating the $k$-digit number $n$ with itself can be factored as $n \cdot (10^k + 1)$ leads to the observation that $10^k + 1$ must have a repeated prime factor (otherwise, in order for the concatenation to be a square, $n$ would have to admit all the same prime factors as $10^k + 1$, but this is impossible, as $n < 10^k + 1$).

Now, per my comment on ncmathsadist's answer, $10^n + 1$ cannot be divisible by $3$ (and hence not $3^2$) and for analogous reasons cannot be divisible by $5^2$. On the other hand, $10^k + 1$ can be divisible by $7^2$, but this only happens when $k \equiv 21 \bmod 42$. The smallest case, $k = 21$, leads to the $42$-digit example above. Similarly, $10^k + 1$ can be divisible by $11^2$, and this leads to the $22$-digit examples above.

This thread from 2004 seems to contain more good discussion of this problem.

This just might be useful. If $n$ is even, $10^n$ is a perfect square, so $10^n + 1$ cannot be a perfect square.

• Perhaps this insight fits better as a comment. Anyway, $10^n + 1$ can never be a square: Since $10 \equiv 1 \bmod 3$, we have $10^n + 1 \equiv 2 \bmod 3$, but checking all three remainders shows that all squares are congruent to $0$ or $1$ modulo $3$. Feb 21 '15 at 13:54