\documentclass[12pt,reqno]{article}

\usepackage[usenames]{color}

\usepackage[colorlinks=true,
linkcolor=webgreen,
filecolor=webbrown,
citecolor=webgreen]{hyperref}

\definecolor{webgreen}{rgb}{0,.5,0}
\definecolor{webbrown}{rgb}{.6,0,0}

\usepackage{color}
\usepackage{fullpage}
\usepackage{float}

\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{.1in}
\setlength{\evensidemargin}{.1in}
\setlength{\topmargin}{-.5in}
\setlength{\textheight}{8.9in}

\newcommand{\seqnum}[1]{\href{http://www.research.att.com/cgi-bin/access.cgi/as/~njas/sequences/e
isA.cgi?Anum=#1}{\underline{#1}}}

\usepackage{epsfig}
\usepackage{latexsym}
\usepackage{amsfonts}

\usepackage{amsmath}
\usepackage{amssymb}

\newcommand{\leg}{\overwithdelims()}
\newcommand{\proof}{{\it Proof. }}
\newcommand{\qed}{\rule{0.5em}{0.5em}}

\begin{document}

\begin{center}
\epsfxsize=4in
\leavevmode\epsffile{logo129.eps}
\end{center}

\begin{center}
\vskip 1cm {\LARGE\bf On Obl\'ath's problem}
\vskip .3in
\large
Alexandru Gica and Lauren\c tiu Panaitopol \\
Department of Mathematics\\
University of Bucharest\\
Str. Academiei 14\\
RO--70109 Bucharest 1\\
Romania\\
\href{mailto:alex@al.math.unibuc.ro}{alex@al.math.unibuc.ro} \\
\href{mailto:pan@al.math.unibuc.ro}{pan@al.math.unibuc.ro} \\
\end{center}


\noindent{\bf Abstract.}
In this paper we determine those squares
whose decimal representation consists of $k\ge 2$ digits 
such that $k-1$ of them equal.   

\vskip .25in


\section{Introduction}

R. Obl\'ath \cite{five} succeeded in almost entirely solving
the problem of finding all the numbers $n^m$ 
($n,m\in{\mathbb N}$, $n\ge2$, $m\ge2$) 
that have equal digits. 
The special case $m=2$ is a very well known result, 
although its proof involves no difficulty. 
In this connection,   
the following question naturally arises: 
is it possible to determine all of the squares 
having all digits but one equal?    

The answer is given by 

\bigskip

{\noindent\bf Theorem~1.1} 
{\it The squares whose decimal representation makes use of $k\ge 2$ digits, 
such that $k-1$ of these digits are equal, 
are precisely 
{\rm 16, 25, 36, 49, 64, 81, 121, 144, 225, 441, 484, 676, 1444, 44944, 
$10^{2i}$, $4\cdot10^{2i}$} and $9\cdot10^{2i}$ with $i\ge1$.}

\bigskip

When we are looking for the squares with $k$ digits 
among which $k-1$ digits equal $0$, 
we immediately get that the corresponding numbers are 
$10^{2i}$, $4\cdot10^{2i}$ and $9\cdot10^{2i}$ with $i\ge1$. 

A simple computation shows that the numbers with at most 4 digits 
verifying the condition in the statement are just the ones listed above. 

Since every natural number can be written in the form $50000k\pm r$ 
with $0\le r\le 25000$, and 
$(50000k\pm r)^2\equiv r^2\pmod {100000}$, 
we compute $r^2$ for $r\le 25000$  and find that the last 4 digits of any square 
can be equal only when all of them equal 0, 
which solves Obl\'ath's problem for squares having $k\ge4$ digits.   

We select the squares such that 4 of the last 5 digits are equal, 
because these point out the possible squares with $k\ge 5$ digits, 
$k-1$ digits of them being equal. 
If one excludes the numbers for which there are $k-1$ digits equal to 0, 
then there still remain 22 types of numbers, namely:  

$
\begin{array}{llll} 
a_1=1\cdots121 & a_7=4\cdots441 & a_{13}=4\cdots4944& a_{18}=7\cdots76\\
a_2=1\cdots161 & a_8=4\cdots449 & a_{14}=4\cdots45444& a_{19}=8\cdots81\\
a_3=2\cdots224 & a_9=4\cdots464 & a_{15}=4\cdots49444& a_{20}=8\cdots89\\
a_4=2\cdots225 & a_{10}=4\cdots484 & a_{16}=5\cdots56& a_{21}=9\cdots929\\
a_5=4\cdots41444 & a_{11}=4\cdots4544 & a_{17}=6\cdots656& a_{22}=9\cdots969\\
a_6=4\cdots4144 & a_{12}=4\cdots4644 & &
\end{array}
$

One will show that, among these numbers with $k\ge 5$ digits, 
only 44944 is a square. 
The exclusion of the other numbers can be carried out fairly easily in certain cases, 
as we show in \S 2. 
In the other cases we will solve equations of the type 
$$x^2-dy^2=k\eqno{(1)}$$
(where $d,k\in{\mathbb Z}^*$, $d>0$ and $\sqrt{d}\not\in{\mathbb Z}$)
in integers.
The literature concerning equation~(1) is rather extensive. 
In this connection, we mention \cite{one,two,three,four}. 

We now recall the solving method (in accordance with \cite{two}). 
We denote by $(r,s)$  the minimal positive solution to the equation 
$$x^2-dy^2=1\eqno{(2)}$$
and by $\varepsilon=r+s\sqrt{d}$. 
We determine the ``small'' solutions to equation~(1) (if any).
They generate all the solutions.  

\bigskip

{\noindent\bf Theorem~1.2} 
{\it We denote by $\mu _i=a_i+b_i\sqrt{d}, i=\overline {1,m}$ 
all the numbers with the property that
$(a_i,b_i)$ is a solution in nonnegative integers to equation~(1) 
with 
$a_i\le\sqrt{|k|\varepsilon}$ and $b_i\le\sqrt{\varepsilon|k|/d}$ (if any). 
If $x$ and $y$ are solutions to~(1) then there exist $i,n\in{\mathbb Z}$ 
such that $1\leq i\leq m$ and 
$x+y\sqrt{d}=\pm\mu _i\varepsilon^n$ 
or $x+y\sqrt{d}=\pm\bar{\mu _i}\varepsilon^n$.}

\bigskip
 
We will use this theorem in \S 3. 

\section{Excluding the simple cases} 

We assume in this section that $k\ge 5$ and $a_n$ is a square, 
hence $9a_n$ is a square as well. 
Make use of simple reasonings, we shall show that this fact is impossible. 
To this end, we use the symbol of Legendre in some cases. 

The 16 cases which have to be excluded will be exposed in a concise form, 
inasmuch as some of them are quite similar: 
$$a_3,a_4,a_{20};\; a_2,a_{15},a_{18};\; a_{11}, a_{17}.$$ 
We mention that each of the cases below is concluded by a contradictory assertion, 
thus proving the impossibility of the corresponding case. 

\smallskip

{\bf 1.} We have 
$9a_2=10^k+449\equiv(-1)^k+9\pmod{11}$. 
But $\left(\frac{8}{11}\right)=\left(\frac{10}{11}\right)=-1$. 

\smallskip

{\bf 2.} It follows by $9a_3=2(10^k+8)=(4x)^2$ that $2^{k-3}5^k=(x-1)(x+1)$. 
Since $(x-1,x+1)=2$, we have $5^k\mid x+\varepsilon$ 
with $\varepsilon\in\{-1,1\}$, 
whence $x+1\ge5^k$. 
Consequently $2^{k-3}\cdot5^k=x^2-1\ge5^k(5^k-2)$, 
hence $2^{k-3}\ge5^k-2$. 

\smallskip

{\bf 3.} By $9a_4=2\cdot10^k+25=(5x)^2$, 
we have $2^{k+1}\cdot5^{k-2}=(x-1)(x+1)$, 
whence $2^{k+1}\cdot5^{k-2}\ge5^{k-2}(5^{k-2}-2)$. 

\smallskip

{\bf 4.} We have $9a_5=4\cdot10^k-27004=(2x)^2$, 
whence $10^k-6751=x^2$. 
When $k$ is an odd number, we have $10^k-6751\equiv2\pmod{11}$, 
but $\left(\frac{2}{11}\right)=-1$.  
If $k=2h$ with $h\ge3$, then $(10^h-x)(10^h+x)=6751$, 
whence $10^h-x=a$, $10^h+x=b$, 
where we have either $(a,b)=(1,6751)$ or $(a,b)=(43,157)$. 
Since $2\cdot10^h=a+b$, it follows that either $2\cdot10^h=6752$ or $2\cdot10^h=200$, 
although $h\ge3$. 

\smallskip

{\bf 5.} By $9a_6=4\cdot10^k-2704=(4x)^2$ 
it follows that $5^2\cdot10^{k-2}-169=x^2$. 
Since $k\ge5$, we get that 
$x^2=5^2\cdot10^{k-2}-169\mathop{\equiv}\limits^4-169\mathop{\equiv}\limits^4 3$.  

\smallskip

{\bf 6.} We have $a_9=4\cdot11\cdots16$, but $11\cdots16$ does not occur among the numbers $a_i$. 

\smallskip

{\bf 7.} We have $a_{10}=4a_1$, and we shall get the contradiction 
after we study $a_1$ for $k\ge 5$. 

\smallskip

{\bf 8.} We have $9a_{11}=4\cdot10^k+896=(8x)^2$, 
hence $2^{k-4}5^k+14=x^2$. 
It follows that $x\vdots2$. Therefore $x^2\vdots4$, 
and $k=5$. 
In this case we get $x^2=6264$.  

\smallskip

{\bf 9.} We have $a_{12}=4a_2$, but $a_2\ne x^2$. 

\smallskip

{\bf 10.} By $9a_{15}=4\cdot10^k+44996=(2x)^2$ 
it follows that $10^k+11249=x^2$. Then 
$10^k+11249\equiv(-1)^k+7\pmod{11}$, 
but $\left(\frac{6}{11}\right)=\left(\frac{8}{11}\right)=-1$. 

\smallskip

{\bf 11.} Since $4a_{16}=\underbrace{22\cdots2}\limits_k 4$ and $a_3\ne x^2$, 
it follows that $a_{16}\ne y^2$. 

\smallskip

{\bf 12.} We have $9a_{17}=6\cdot10^k-96=(4x)^2$, 
hence $3\cdot2^{k-3}5^k-6=x^2$. 
But $x^2\vdots4$ and $3\cdot2^{k-3}5^k\vdots4$ (because $k\ge5$). 

\smallskip

{\bf 13.} We have $9a_{18}=7\cdot10^k-16\equiv7(-1)^k-5\pmod{11}$. 
But $\left(\frac{2}{11}\right)=\left(\frac{10}{11}\right)=-1$. 

\smallskip

{\bf 14.} By $9a_{20}=8\cdot10^k+1=x^2$ it follows that $(x-1)(x+1)=2^{k+3}5^k$ 
and then $2^{k+3}5^k\ge5^k(5^k-2)$. 

\smallskip

{\bf 15.} We have $a_{21}\equiv2\pmod{9}$. 

\smallskip

{\bf 16.} We have $a_{22}\equiv6\pmod{9}$. 

\section{The six difficult cases} 

Just as in the previous cases, 
the numbers under consideration have $k\ge5$ digits, and $k-1$ of these digits are equal. 

{\bf 1.} For $a_1=11\cdots121=x^2$ it follows that $(10^k-1)/9+10=x^2$. 
We denote $y=3x$ and, since $k\ge5$, we have $y>316$ and 
$$10^k-y^2=-89.\eqno(3)$$
For $k=2m$ we have $(10^m-y)(10^m+y)=-89$, 
whence we get both $10^m-y=-1$ and $10^m+y=89$, 
which is a contradiction. 

For $k=2m+1$, we denote $z=10^m$ and then 
$$y^2-10z^2=89.$$
The primitive solution of the Pell equation 
$$x^2-10y^2=1$$
is $(r,s)=(19,6)$. 
Making use of Theorem 1.2 in the Introduction, 
we get
$b_i\le\sqrt{\frac{89}{10}\left(19+6\sqrt{10}\right)}$, hence $b_i\le18$. 
We find $b_1=8,a_1=27$, and $b_2=10,a_2=33$. 

It follows that either 
$$y+z\sqrt{10}=\left(\pm27\pm8\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t$$
or
$$y+z\sqrt{10}=\left(\pm33\pm10\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,$$
with $t\in{\mathbb Z}$. 
Since $y>0$, $z>0$, 
we have only the solutions 
$$y+z\sqrt{10}=\left(27\pm8\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t$$
and
$$y+z\sqrt{10}=\left(33\pm10\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,$$
with $t\in{\mathbb Z}$. 
Since $\frac{27+8\sqrt{10}}{19+6\sqrt{10}}<2$ 
and $\frac{33+10\sqrt{10}}{19+6\sqrt{10}}<2$, 
it follows that $t\in{\mathbb N}$. 
Let $\left(19+6\sqrt{10}\right)^t=a_t+b_t\sqrt{10}$, 
$a_t,b_t\in{\mathbb N}$, $a_0=1,b_0=0$. 
For $t\ge 1$, we have the following equalities:
$$a_t=19^t+C_t^2 19^{t-2}\cdot 6^2\cdot10+\cdots\eqno{(4)}$$
and
$$b_t=C_t^1 19^{t-1}\cdot6+C_t^3 19^{t-3}\cdot 6^3\cdot 10+\cdots.\eqno{(5)}$$
We have $a_t\equiv1\pmod{3}$ and $b_t\equiv0\pmod{3}$. 
Since $z=10^m\equiv1\pmod{3}$, 
we only have one of the situations 
$$y+z\sqrt{10}=\left(27-8\sqrt{10}\right)\left(19+6\sqrt{10}\right),
\quad t\in{\mathbb N},\eqno{(6)}$$
and 
$$y+z\sqrt{10}=\left(33+10\sqrt{10}\right)\left(19+6\sqrt{10}\right),
\quad t\in{\mathbb N}.\eqno{(7)}$$

{\it a)} In the case of the relation~(6), we have the identity
$$z=10^m=27b_t-8a_t.\eqno{(8)}$$
Since $k\ge5$, it follows that $m\ge2$. 

For $m=2$, the equation~(3) takes the form 
$y^2-10^5=89$, and has no integer solutions. 

For $m\ge3$, it follows that $8\mid b_t$. 
By~(5) we have $b_t\equiv 6t\cdot19^{t-1}\pmod 8$, 
whence $t=4h$. 
It then follows by (4)~and~(5) that 
$$a_t\equiv 6^{4h}\cdot10^{2h}\pmod {19}
\mbox{ and }19\mid b_t.$$
By (8) we get $10^m\equiv-8\cdot6^{4h}\cdot10^{2h}\pmod{19}$, 
whence 
$$\left(\frac{10^m}{19}\right)
=\left(\frac{-8\cdot6^{4t}\cdot10^{2h}}{19}\right)
=\left(\frac{-2}{19}\right)=1.$$
Since 
$\left(\frac{10}{19}\right)=\left(\frac{-9}{19}\right)
=(-1)\cdot\left(\frac{3^2}{19}\right)
=-1$, 
it follows that $m=2f$. 

The equation~(3) takes the form 
$$10^{4f+1}+89=y^2.\eqno{(9)}$$
We have $10^4\equiv1\pmod{101}$, 
hence $10^{4f+1}\equiv10\pmod{101}$. 
In view of (9), it follows that 
$$y^2\equiv99\pmod{101}.$$
But $\left(\frac{99}{101}\right)=\left(\frac{-2}{101}\right)=
\left(\frac{2}{101}\right)=-1$, 
and thus a contradiction. 

{\it b)} It follows by (7) that 
$$z=10^m=33b_t+10a_t.\eqno{(10)}$$
Since $m\ge3$, it follows that $b_t+2a_t\equiv0\pmod{8}$. 
By (4)~and~(5) we have 
$a_t\equiv19^t\pmod{8}$ and $b_t\equiv6t\cdot19^{t-1}\pmod{8}$. 
Therefore $6t\cdot19^{t-1}+2\cdot19^t\equiv0\pmod{8}$, 
which in turn implies $3t+19\equiv0\pmod{4}$ 
and $t=4h+3$. 
Now (4), (5) and (10) imply that 
$10^m\equiv33\cdot6^{4h+3}\cdot10^{2h+1}\pmod{19}$, 
whence 
$$
\begin{aligned}
\left(\frac{10^m}{19}\right) 
&=\left(\frac{33\cdot6\cdot10\phantom{{}^{}}}{19}\right)
=\left(\frac{3^2\cdot2^2\cdot55}{19}\right)\nonumber\\
&=\left(\frac{55}{19}\right)
=\left(\frac{-2}{19}\right)
=-\left(\frac{2}{19}\right)
=-(-1)^{(19^2-1)/8}\nonumber\\
&=1.
\end{aligned}
$$
Consequently $m=2f$, and we get (9) again, which is a contradiction. 

{\bf 2.} For $a_7=44\cdots41=x^2$ it follows that 
$4\cdot\frac{10^k-1}{9}-3=x^2$, 
hence 
$$4\cdot10^k-y^2=31,\eqno(11)$$
where $y=3x$. 

If $k=2m$, then $(2\cdot10^m-y)(2\cdot10^m+y)=31$. Hence 
$$2\cdot10^m-y=1\mbox{ and }2\cdot10^m+y=31,$$
which is a contradiction. 
If $k=2m+1$ then, denoting $z=2\cdot10^m$, we get the equation
$$y^2-10z^2=-31.$$
Just as in the previous case, we make use of Theorem 1.2
and, for $y>0$, $z>0$, we get that 
either 
$$y+z\sqrt{10}=\left(3+2\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t
\eqno{(12)}$$
or
$$y+z\sqrt{10}=\left(-3+2\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,
\eqno{(13)}$$
with $t\in{\mathbb N}$. 

{\it a)} By (12) we obtain the equation:
$$2\cdot10^m=3b_t+2a_t.\eqno{(14)}$$
Since $m\ge 2$, it follows by (5), (6) and (14) that 
$3\cdot6t\cdot19^{t-1}+2\cdot19^t\equiv0\pmod{8}$, 
that is, 
$9t+19\equiv0\pmod{4}$, 
whence $t=4h+1$. 
By (4)~and~(5) we get that $z\equiv3\cdot6^{4h+1}\cdot10^{2h}\pmod{19}$, 
that is, 
$10^m\equiv3^2\cdot6^{4h}\cdot10^{2h}\pmod{19}$, 
whence $\left(\frac{10^m}{19}\right)=1$. 
Consequently $m$ is an even number. 

On the other hand, it follows by~(14) that $3b_t+2a_t\equiv0\pmod{5}$, 
that is, 
$a_t\equiv b_t\pmod{5}$. 
By (4)~and~(5) it follows that 
$a_t\equiv(-1)^t\pmod{5}$ and $b_t\equiv(-1)^{t-1}t\pmod{5}$, 
whence $t\equiv4\pmod{5}$. 
We have 
$(3+\sqrt{10})^5=4443+1405\sqrt{10}\equiv-53\pmod{281}$, 
hence 
$(19+6\sqrt{10})^5=\big((3+\sqrt{10})^5\big)^2
\equiv53^2\equiv-1\pmod{281}$. 
Consequently
$$\begin{aligned}
y+2\cdot10^m\sqrt{10}
&=\left(3+2\sqrt{10}\right)\left(19+6\sqrt{10}\right)^{t+1}\left(19-6\sqrt{10}\right)\nonumber\\
&=\left(-63+20\sqrt{10}\right)\left[\left(19+6\sqrt{10}\right)^5\phantom{{}^{{}^{}}}\right]^{(t+1)/5}\nonumber\\
&\equiv-63+20\sqrt{10}\pmod{281}.\nonumber
\end{aligned}
$$ 
We have taken into account that $t\equiv4\pmod{5}$ 
and $t$ is an odd number. 

We have $2\cdot10^m\equiv20\pmod{281}$, 
that is, $10^{m-1}\equiv1\pmod{281}$. 
Since $10^7\equiv53\pmod{281}$, 
it follows that $10^{14}\equiv-1\pmod{281}$ 
and $10^{28}\equiv1\pmod{281}$. 
Thus we have ${\rm ord}\,\overline{10}=28$ in ${\mathbb Z}_{281}$, 
whence $28\mid m-1$, 
which is a contradiction since $m$ is even. 

{\it b)} It follows by (13) that 
$$2\cdot10^m=-3b_t+2a_t.\eqno{(15)}$$ 
Since $m\ge2$, it follows that $-3b_t+2a_t\equiv0\pmod{8}$. 
We get by (4)~and~(5) that $t=4h+3$ and then 
$2\cdot10^m\equiv-3\cdot6^{4h+3}\cdot10^{2h+1}\pmod{19}$. 
Therefore 
$\left(\frac{10^m}{19}\right)=1$, 
and $m$ is even. 
Also by~(15) we get $a_t+b_t\equiv0\pmod{5}$, 
and in view of (4)~and~(5) we have $t\equiv1\pmod{5}$. 
The relation~(13) can be written as: 
$$\begin{aligned}
y+2\cdot10^m\sqrt{10}
&=\left(-3+2\sqrt{10}\right)\left(19+6\sqrt{10}\right)^{t-1}\left(19+6\sqrt{10}\right)\nonumber\\
&=\left(63+20\sqrt{10}\right)\left(\left(19+6\sqrt{10}\right)^5\phantom{{}^{{}^{}}}\right)^{(t-1)/5}\nonumber\\
&\equiv63+20\sqrt{10}\pmod{281}.\nonumber
\end{aligned}$$ 
Just as in the case {\it a)}, 
it follows that $2\cdot10^m\equiv20\pmod{281}$. 
The relation $10^{m-1}\equiv1\pmod{281}$ contradicts the fact that $m$ is even. 

{\bf 3.} 
For $a_8=44\cdots49=x^2$ we have $4\cdot\frac{10^k-1}{9}+5=x^2$. 
We denote $3x=y$ and then 
$$4\cdot10^k+41=y^2.$$
For $k=2m$, we get the equalities 
$y-2\cdot10^m=1$ and $y+2\cdot10^m=41$, which is a contradiction because $m\ge 2$. 

For $k=2m+1$ we set $z=2\cdot10^m$, 
and then 
$y^2-10z^2=41$. 
Whence for $y>0$ and $z>0$ we get either
$$y+2\cdot10^m\sqrt{10}=\left(9-2\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,\eqno{(16)}$$
or 
$$y+2\cdot10^m\sqrt{10}=\left(9+2\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,\eqno{(17)}$$
where $t$ is a natural number.

{\it a)} It follows by (16) that 
$$2\cdot10^m=9b_t-2a_t.$$
Since $2\cdot10^m\equiv2\pmod{3}$, 
and on the other hand we have by~(4) that $a_t\equiv1\pmod{3}$, 
we get the contradiction $2\equiv-2\pmod{3}$. 

{\it b)} It follows by (17) that 
$$2\cdot10^m=2a_t+9b_t.\eqno{(18)}$$
Then $b_t\equiv2a_t\pmod{5}$, 
whence $t\equiv3\pmod{5}$. 
We also have $b_t+2a_t\equiv0\pmod{4}$, hence $t$ is odd. 

The equality (17) takes the form 
$$\begin{aligned}
y+2\cdot10^m\sqrt{10}
&=\left(9+2\sqrt{10}\right)\left(19+6\sqrt{10}\right)^{t+2}\left(19-6\sqrt{10}\right)^2\nonumber\\
&=\left(1929-610\sqrt{10}\right)\left[\left(19+6\sqrt{10}\right)^5\phantom{{}^{{}^{}}}\right]^{(t+2)/5}\nonumber\\
&\equiv38+48\sqrt{10}\pmod{281},\nonumber\\ 
\end{aligned}
$$
since $(t+2)/5$ is odd and $\left(19+6\sqrt{10}\right)^5\equiv-1\pmod{281}$. 

Thus $2\cdot10^m\equiv48\pmod{281}$, 
hence 
$\left(\frac{2\cdot10^m}{281}\right)=\left(\frac{48\phantom{{}^{}}}{281}\right).$ 
Therefore, 
$$(-1)^{\frac{281^2-1}{8}(m+1)}\left(\frac{5^m\phantom{{}^{}}}{281}\right)
=\left(\frac{3\phantom{{}^{}}}{281}\right).$$ 
We have 
$\left(\frac{5}{281}\right)=\left(\frac{281}{5}\right)
=\left(\frac{1}{5}\right)=1$ 
and 
$\left(\frac{3}{281}\right)=\left(\frac{281}{3}\right)
=\left(\frac{2}{3}\right)=-1$, 
hence a contradiction. 

{\bf 4.} 
For $a_{13}=44\cdots4944=x^2$, 
we have $4\cdot\frac{10^k-1}{9}+500=x^2$, 
that is, 
$y^2-25\cdot10^{k-2}=281$, 
where $y=\frac{3}{4}x$. 

If $k=2m+2$, then $(y-5\cdot10^m)(y+5\cdot10^m)=281$, 
whence $y-5\cdot10^m=1$ and $y+5\cdot10^m=281$. 
One gets the contradiction $10^{m+1}=280$. 

If $k=2m+3$, we denote $z=5\cdot10^m$. 
We have $m\ge1$ and 
$$y^2-10z^2=281\eqno{(19)}$$
whence either 
$$y+z\sqrt{10}=\left(21+4\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,
\quad t\in{\mathbb N},\eqno{(20)}$$
or 
$$y+z\sqrt{10}=\left(21-4\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,
\quad t\in{\mathbb N}^*.\eqno{(21)}$$

{\it a)} By (20) it follows that 
$$5\cdot10^m=21b_t+4a_t,$$
hence $5\cdot10^m\equiv4a_t\pmod{3}$. 
Since $a_t\equiv1\pmod{3}$, we get the contradiction $5\equiv4\pmod{3}$. 

{\it b)} By (21), if $t=1$ then $y=159$ and $z=50$, 
whence $m=1$ and then $k=5$. 
One thus get the number 
$$44944=212^2.$$
For $t\ge2$, it follows that 
$y+\sqrt{10}\cdot5\cdot10^m=\left(159+50\sqrt{10}\right)\left(19+6\sqrt{10}\right)^s$, $s\ge 1$, 
hence 
$$5\cdot10^m=159b_s+50a_s.\eqno{(22)}$$
For $m=0$ and $m=2$, equation (19) has no integer solutions, hence we may consider $m\ge3$. 
We have by~(22) that $b_s\equiv2a_s\pmod{8}$. 
Hence it follows by (4)~and~(5) that 
$6s\cdot19^{s-1}\equiv2\cdot19^s\pmod{8}$. 
Therefore $3s\equiv19\pmod{4}$  
and $s=4h+1$. 
Also by (22) we have 
$5\cdot10^m\equiv159\cdot6^s\cdot10^{2h}\pmod{19}$, 
hence 
$\left(\frac{5\cdot10^m}{19}\right)=
\left(\frac{159\phantom{{}^{}}}{19}\right)\left(\frac{6^s}{19}\right)=
\left(\frac{7}{19}\right)$, 
because $\left(\frac{6}{19}\right)=1$. 
Since
$$\left(\frac{5}{19}\right)
=\left(\frac{-14}{19}\right)
=(-1)^{\frac{19-1}{2}}(-1)^{\frac{19^2-1}{8}}\left(\frac{7}{19}\right)
=\left(\frac{7}{19}\right),$$ 
we have $\left(\frac{10^m}{19}\right)=1$, 
that is, 
$\left(\frac{10}{19}\right)^m=1$, 
whence $(-1)^m=1$. 
Thus $m=2n$. 

Equality (19) takes the form 
$$y^2=25\cdot10^{2m+1}+281=25\cdot10^{4n+1}+281.$$
Since $10^4\equiv1\pmod{101}$, 
it follows that 
$y^2\equiv250+281\pmod{101}$. 
Hence $y^2\equiv26\pmod{101}$, 
whence $\left(\frac{26}{101}\right)=1$. 
But 
$\left(\frac{26}{101}\right)=\left(\frac{-75}{101}\right)
=\left(\frac{3}{101}\right)=\left(\frac{101}{3}\right)
=\left(\frac{2}{3}\right)=-1$, 
which is a contradiction. 

{\bf 5.} For $a_{14}=44\cdots45444=x^2$ and $y=3x/2$ we have the equation:
$$y^2-10^k=2249.$$
If $k=2m$, $m\ge 3$, we have 
either 
$$y-10^m=1\mbox{ and }y+10^m=2249$$
or
$$y-10^m=13\mbox{ and }y+10^m=173,$$
and none of these systems has solutions. 

If $k=2m+1$, then $m\ge2$. 
With $z=10^m$ we have the equation:
$$y^2-10z^2=2249.\eqno{(23)}$$
The initial solutions $(a,b)$ of the equation are 
$(57,10)$, $(147,44)$, 
$(153,46)$, hence the solutions with $y>0$, $z>0$ are given by the identities:
$$\begin{aligned}
\qquad\qquad y+10^m\sqrt{10}
&=\left(57-10\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,&\,\qquad\qquad\qquad(24)\\ 
y+10^m\sqrt{10}
&=\left(57+10\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,&(25)\\
y+10^m\sqrt{10}
&=\left(147-44\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,&(26)\\
y+10^m\sqrt{10}
&=\left(147+44\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,&(27)\\
y+10^m\sqrt{10}
&=\left(153-46\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,&(28)\\
y+10^m\sqrt{10}
&=\left(153+46\sqrt{10}\right)\left(19+6\sqrt{10}\right)^t,&(29)\\
\end{aligned}$$
where $t\in{\mathbb N}$. 
We get by~(24) that $10^m=57b_t-10a_t$, 
hence $10^m\equiv-a_t\pmod{3}$, 
which yields the contradiction $1\equiv-1\pmod{3}$. 

If (27) was true, then $10^m=147b_t+44a_t$. 
Since $a_t\equiv1\pmod{3}$ and $10^m\equiv1\pmod{3}$, 
the contradiction $1\equiv44\pmod{3}$ follows. 

In the case when (28) holds, 
we get $10^m=153b_t-46a_t$, whence the contradiction $1\equiv-46\pmod{3}$. 

We still have to study three situations. 

{\it a)} We have by (25) that 
$$10^m=57b_t+10a_t.\eqno(30)$$
Since $m\ge 2$, it follows that $b_t+2a_t\equiv0\pmod{4}$. 
By (4)~and~(5) we have 
$6t(-1)^{t-1}+2(-1)^t\equiv0\pmod{4}$. 
Therefore $3t-1\equiv0\pmod{2}$, 
and we get that $t$ is odd. 
It then follows that $19\mid a_t$, 
and by~(30) we deduce the contradiction $19\mid10^m$. 

{\it b)} It follows by (26) that 
$$10^m=147b_t-44a_t.\eqno{(31)}$$
Just as in the case~a), by considering congruences $\pmod{4}$, we get that $t$ is even. 

Also by (31) we have $2b_t+a_t\equiv0\pmod{5}$, 
whence by (4)~and~(5) we get $t\equiv3\pmod{5}$. 
Then $(t+2)/5$ is an even natural number. 
The relation~(26) takes the form 
$$\begin{aligned}
y+10^m\sqrt{10}
&=\left(147-44\sqrt{10}\right)\left(19+6\sqrt{10}\right)^{t+2}\left(19-6\sqrt{10}\right)^2\nonumber\\
&\equiv\left(147-44\sqrt{10}\right)\left(721-228\sqrt{10}\right)\pmod{281}\nonumber\\
&\equiv\left(147-44\sqrt{10}\right)\left(-122+53\sqrt{10}\right)\pmod{281}.\nonumber
\end{aligned}$$
It then follows that $10^m\equiv13159\pmod{281}\equiv-48\pmod{281}$, 
hence $\left(\frac{10^m}{281}\right)=\left(\frac{-48\phantom{{}^{}}}{281}\right)$. 
One directly gets a contradiction, 
observing that 
$\left(\frac{10}{281}\right)=\left(\frac{-1}{281}\right)
=\left(\frac{16}{281}\right)=1$ and 
$\left(\frac{3}{281}\right)=-1$. 

{\it c)} By (29) we have the equation:
$$10^m=153b_t+46a_t.\eqno{(32)}$$
For $m=2$, we get the number 102249 which is not a square. 
Hence $m\ge3$. 

For $m\ge3$, we have $b_t-2a_t\equiv0\pmod{8}$, 
and then $t=4h+1$. 
Also by~(32) we have $3b_t+a_t\equiv0\pmod{5}$, 
whence $t\equiv2\pmod{5}$. 
Therefore $(t-2)/5$ is an odd natural number, 
which in turn implies that 
$\left(19+6\sqrt{10}\right)^{(t-2)/5}\equiv-1\pmod{281}$. 
By~(29) we have the following relations:
$$\begin{aligned}
y+10^m\sqrt{10}
&=\left(153+46\sqrt{10}\right)\left(19+6\sqrt{10}\right)^{t-2}\left(19+6\sqrt{10}\right)^2\nonumber\\
&\equiv-\left(153+46\sqrt{10}\right)\left(-122-53\sqrt{10}\right)\pmod{281}.\nonumber
\end{aligned}$$ 
Then $10^m\equiv13721\equiv-48\pmod{281}$, 
that is, the contradiction from~{\it b)}. 

{\bf 6.} For $a_{19}=88\cdots81=x^2$, denoting $y=3x$ we get the equation:
$$y^2=8\cdot10^k-71.$$
If $k=2m$, then $m\ge3$. 
We denote $z=2\cdot10^m$ and get the identity:
$$y^2-2z^2=-71.$$
It then follows for $y,z>0$ that 
either 
$$y+z\sqrt{2}=\left(1+6\sqrt{2}\right)\left(3+2\sqrt{2}\right)^t,\eqno{(33)}$$
or
$$y+z\sqrt{2}=\left(-1+6\sqrt{2}\right)\left(3+2\sqrt{2}\right)^t.\eqno{(34)}$$
We set $\left(3+2\sqrt{2}\right)^t=c_t+d_t\sqrt{2}$. 
For $t\ge1$ we then have the equalities:
$$\begin{aligned}
\quad\qquad\qquad c_t
&=3^t+C_t^2\cdot3^{t-2}\cdot2^2\cdot2+\cdots
,&\quad\qquad\qquad\qquad\qquad\qquad(35)\\ 
d_t
&=2t\cdot3^{t-1}+C_t^3\cdot3^{t-3}\cdot2^4+\cdots&(36)\\
\end{aligned}$$

{\it a)} We have by (33) that $d_t+6c_t\equiv0\pmod{8}$. 
Then $2t+18\equiv0\pmod{8}$, 
hence $t=4h+3$, 
whence $d_t\equiv2^{t+(t-1)/2}\pmod{3}$. 
We have $z=d_t+6c_t$. 
It follows that $2\cdot10^m\equiv d_t\pmod{3}$, 
hence $2\cdot10^m\equiv2^{6h+4}\pmod{3}$, 
whence $10^m\equiv2^{6h+3}\pmod{3}$,
consequently,  
$$\left(\frac{10^m}{3}\right)
=\left(\frac{2^{6h+3}}{3}\right)
=\left(\frac{2^{3k+1}}{3}\right)^2\cdot\left(\frac{2\phantom{{}^{}}}{3}\right)
=-1.$$
Since $\left(\frac{10^m}{3}\right)=\left(\frac{1\phantom{{}^{}}}{3}\right)$, 
a contradiction follows. 

{\it b)} For $k=2m$, 
we consider the equality~(34) 
and we have $2\cdot10^m=-d_t+6c_t$, 
hence $d_t\equiv6c_t\pmod{8}$. 
It follows that $2t\equiv18\pmod{8}$, that is, $t=4h+1$. 
We then have $2\cdot10^m\equiv-d_t\equiv-2^{4h+1}\cdot2^{2h}\pmod{3}$. 
Hence $10^m\equiv-(2^{3h})^2\pmod{3}$ and 
$\left(\frac{10^m}{3}\right)=\left(\frac{-1\phantom{{}^{}}}{3}\right)
=-1\ne1=\left(\frac{10^m}{3}\right)$. 

For $k=2m+1$ we have $m\ge2$. 
Denoting $z=4\cdot10^m$, we get the equation:
$$y^2-5z^2=-71.$$
For $y,z>0$ we have 
either 
$$y+z\sqrt{5}=\left(3+4\sqrt{5}\right)\left(9+4\sqrt{5}\right)^t,\eqno{(37)}$$
or
$$y+z\sqrt{5}=\left(-3+4\sqrt{5}\right)\left(9+4\sqrt{5}\right)^t,\eqno{(38)}$$
where $t$ is a natural number.

We put $\left(9+4\sqrt{5}\right)^t=e_t+f_t\sqrt{5}$ 
and then 
$$\begin{aligned}
\quad\qquad\qquad e_t
&=9^t+C_t^2\cdot9^{t-2}\cdot4^2\cdot5+\cdots
,&\hskip-2.8pt\qquad\qquad\qquad\qquad\qquad(39)\\ 
f_t
&=4t\cdot9^{t-1}+C_t^3\cdot9^{t-3}\cdot4^3\cdot5+\cdots&(40)\\
\end{aligned}$$
It follows by (37) and (38) that 
$z=4\cdot10^m=4e_t\pm 3f_t$, 
hence $4e_t\pm3f_t\equiv0\pmod{8}$. 
By (39)~and~(40) we get $4\pm4t\equiv0\pmod{8}$, 
whence $t=2h+1$. 

By $4\cdot10^m=4e_t\pm 3f_t$ we infer $4\cdot10^m\equiv e_t\pmod{3}$. 
Since $t$ is odd, we have $e_t\equiv0\pmod{3}$, 
and the contradiction $4\cdot10^m\equiv0\pmod{3}$. 

\medskip

{\it Remarks.} It would be interesting to solve the similar problem 
involving numbers written with respect to  some basis $b\ge2$. 

It might be more difficult to consider the same problem 
imposing the condition all-but-one-equal-digits to higher powers, instead of squares.  




\begin{thebibliography}{4}

\bibitem{one} G. Chrystal 
{\sl Algebra. An Elementary Textbook}. 
Part II, Dover, New York, 1961,  
pp.\ 478--486. 

\bibitem{two} A. Gica, 
Algorithms for the equation $x^2-dy^2=k$. 
{\it Bull.\ Math.\ Soc.\ Sci.\ Math.\ Roumanie} {\bf 38}({\bf 86}) (1994-1995), 153--156. 

\bibitem{three} R.E. Mollin, 
{\sl Fundamental Number Theory with Applications}. 
C.R.C. Press, Boca Raton, 1998, 
pp.\ 299--302, 232. 

\bibitem{four} I. Niven, H.S. Zuckerman, H.L. Montgomery, 
{\sl An Introduction to the Theory of Numbers}. 
Fifth edition. John Wiley \& Sons, Inc., New York, 1991, pp. 346--358.  

\bibitem{five} R. Obl\'ath, 
Une propriet\'e des puissances parfaites. 
{\it Mathesis} {\bf 65} (1956), 356--364. 

\end{thebibliography}

\bigskip
\hrule
\bigskip

\noindent 2000 {\it Mathematics Subject Classification}:
Primary 11A63; Secondary 11D09, 11D61.

\noindent \emph{Keywords: square, equal digits, Pell equation}


\bigskip
\hrule
\bigskip

\noindent (Concerned with sequence
\seqnum{A018885}.)

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received March 12 2003;
revised version received September 15 2003.  
Published in {\it Journal of Integer Sequences}, October 2 2003.

\bigskip
\hrule
\bigskip

\noindent
Return to
\htmladdnormallink{Journal of Integer Sequences home page}{http://www.math.uwaterloo.ca/JIS/}.
\vskip .1in


\end{document}
