# Is there any perfect square in the sequence $12,123,1234,12345,…$?

Let $x_n$ be the number constructed by concatenating the first $n$ positive integers. Is there any perfect square in the sequence $(x_n)_{n ≥ 2}$ ?

This is OEIS A007908. This is the sequence of Smarandache numbers. We don't know any index $n$ such that $x_n$ is a prime number (see here, or OEIS page linked before).

This Mathematica code suggests that there is no perfect square for $n<1000$:

For[i = 1; t = i, i < 1000,
t = 10^(Floor[Log10[i]] + 1)*t + i, ++i;
If[ Floor[Sqrt[t]] == t, Print[t]]
]


Similarly, using Surd[t, k] it seems that $x_n$ is not a $k$-th power for $n≤1000$, $k≤5$. According to On the back concatenated square sequence (Ling Li), the similar sequence $14,149,14916,1491625$ obtained by concatenating the first $n$ squares is conjectured to contain no perfect square. I think that induction could be used.

Thank you for your help!

• squares are scarcer than primes – Jorge Fernández Hidalgo Aug 24 '16 at 21:22
• Here's something: we have $x_n\equiv n(n+1)/2\bmod 9$. The quadratic residues mod 9 are 0,1,4,7, and the values of $n(n+1)$ mod 9 are 0,2,3,6. So if there is a square, it occurs when $n\equiv \pm 1\bmod 9$. I think you can do something similar with $\bmod 11$, and this should at the very least make it easier to search larger numbers. – Samir Khan Aug 24 '16 at 21:28
• I don't think it makes it easier, since $a_n$ is calculated recursively either way – Jorge Fernández Hidalgo Aug 24 '16 at 21:32
• You can calculate them non-recursively if you want. And this will decrease how many numbers you need to check. – Samir Khan Aug 24 '16 at 21:35
• calculating non recursively is a terrible idea, you have to calculate the whole number each time you check. – Jorge Fernández Hidalgo Aug 24 '16 at 21:47