# Can $10101\dots1$ be a perfect square in any base?

Inpired by another question and it's answer I started to wonder if it's true in other bases as well. I've at least not found any base $b$ where $10101\dots1 = (b^{2k}-1)/(b^2-1)$ (where $k>1$) is a perfect square anytime.

From the answers we can conclude that $8|b^2$ which means that the base must be a multiple of $4$. This is because we must have $b^2/8$ to be an integer.

Also I think/guess that $b^k+1$ must be a perfect square for some $k$. This is because

$${b^{2k}-1\over b^2-1} = {(b^k-1)(b^k+1)\over (b-1)(b+1)}$$

has to be a square.

I've also found that the question is equivalent to if $111\cdots1$ can be a perfect square in base $b^2$. I've seen that it can be a perfect square in base $8$, but $8$ is no perfect square.

• isn't it $1$ a perfect square in base $b^2$? Sep 8, 2017 at 14:58
• @NombreFalso123 Yes, but I probably should have excluded that one... Sep 8, 2017 at 15:00
• This post may contain something useful. Your case is $x=b^2$, $n=2$, $m$ unknown. Also this post may help when $k$ is even? Sep 8, 2017 at 15:03
• A quick search shows no perfect squares for $b,n<100$. My code won't work for numbers bigger than that. file.io/feg1Zp
– Jam
Sep 9, 2017 at 1:13

Just some ideas, too long for comments.

Summary: No such square exists if either $b$ or $k$ is even.

This can be written as $(b^k)^2-(b^2-1)y^2=1$.

The set of positive integer solutions to the Pell equation $x^2-(b^2-1)y^2=1$ are exactly the values:

$$x+y\sqrt{b^2-1}=\left(b+\sqrt{b^2-1}\right)^n; n\in\mathbb Z^{+}$$

So you need to show that $x$ is a power of $b$ only when $n=1$.

There is a recurrence: $x_0=1,x_1=b, x_{n+1}=2bx_n-x_{n-1}$.

This gives $x_2=2b^2-1, x_3=4b^3-3b=b(4b^2-3)$. There is no $b$ (other than $1$) which makes $x_3$ a power of $b$.

We can show that $x_{2n}\equiv (-1)^n\pmod {b^2}$ and $x_{2n+1}\equiv (-1)^{n}b(2n+1)\pmod{b^3}$.

So $x_{2n}$ is never a power of $b$, and if $x_{2n+1}$ is a non-trivial power of $b$, then $2n+1$ is divisible by $b^2$.

In particular, you can't have $b$ even.

You can prove inductively that $x_k>b^{k}$ for $k>1$, so the number of digits base $b$ must be at least $b$.

We also get that $x_{m}\equiv (-1)^m\pmod{b+1}$. Then if $x_{2n+1}=b^k$ then $$b^{k}+1\equiv 0\pmod{b+1}$$ and thus $k$ must be odd.

Now, from $y^2=1+b^2+b^4+\cdots +b^{2(k-1)}$ you get that $y^2\equiv k\pmod{b^2-1}$. Since $b$ is odd, you have $8\mid b^2-1$ and since $k$ is odd, we must have that $k\equiv 1\pmod{8}$.

Aside: Actually, $x_n=T_n(b)$ where $T_n$ are the Chebyshev polynomials of the first kind. This might be helpful, not sure. So we are seeking $b,m,k$ so that $T_m(b)=b^k.$

We know that $b,m$ must be odd, $b^2\mid m$, and $k$ must be odd and a square modulo $b^2-1$.

We also have $b^{m}<T_m(b)<2^mb^m$ so $m<k<m(1+\log_b 2)$.

For instance, this means that the smallest $k$ to check for $b=3$ is $k=33,41,49,57.\dots$.

For $b=5$ the smallest candidates for $k$ are: $k=33,81,97,105,\dots.$

For $b=7$, the smallest candidates are $k=57,153,169,177,\dots$.

If $f(x)=1+x+x^2+\cdots +x^{k-1}$ where $k$ is odd, then:

$$f(x)(1-x)+f(-x)(1+x)=2$$

Also, $f(x)f(-x)=\frac{x^{2k}-1}{x^2-1}$, and, again because $k$ is odd, $f(b)$ is odd for any $b$.

This means that $f(b)$ and $f(-b)$ must both be squares.

That means you need $(111\dots1)_b$ a square and $((b-1)0(b-1)0\dots (b-1)01)_b$ to be perfect squares.