# Can repunits be perfect cubes?

Is it true that the equation $10^{n}-9m^{3}=1$ has only one positive integer solution, namely $n=m=1$? I can't find the answer. This has an equivalent description that the repunits $R_n = 11\dots1$ are not cubic numbers.

-
I think this question is better suited for math.stackexchange. It looks like a straightforward exercise in elementary number theory. (Hint: Solve $b^3\equiv1\mod10$ for $b$ and then $(10a+b)^3\equiv11\mod100$ for $a$.) –  Barry Cipra May 27 '13 at 15:21
I know that Rn≡n(mod 9), and if Rn is a cubic number then n≡0, ±1(mod 9). The left appears difficult. –  Wangt Fei May 27 '13 at 15:34
In case it is of interest, it is even known this cannot be a perfect power (not just not a cube), proved by Bugeaud and Mignotte in "Sur l'équation diophantienne $(x^n - 1)/(x-1)= y^q$, II" (see Thm 5). –  quid May 27 '13 at 15:39
@Barry: This elementary method doesn't work. In fact, it's not too hard to see that for every positive integer $d$, there exists an integer whose cube ends in at least $d$ digits $1$. (And this number is unique modulo $10^{d+1}$.) –  Tom De Medts May 27 '13 at 15:48
@Tom (and Wangt Fei) sorry, you're absolutely right. I made a very stupid mistake. I somehow miscomputed $(10a+1)^3 \equiv30a^2 + 1$ instead of $30a+1$. –  Barry Cipra May 27 '13 at 16:51

Rather to my surprise I find an entirely elementary proof that $R_1=1$ is the only (decimal) repunit cube, using nothing beyond quadratic reciprocity (namely the formula for the Legendre symbol $(-5/p)$).

Let us first dispose of the case that $n$ is even, say $n=2k$. This is routine: write the equation $10^n - 9m^3 = 1$ as $$9m^3 = 10^n - 1 = 10^{2k} - 1 = (10^k-1) (10^k+1).$$ The two factors are relatively prime, and $10^k-1$ is a multiple of $9$. Thus once $k>0$ it follows that $10^k-1 = 9m_1^3$ and $10^k+1 = m_2^3$ for some $m_1^{\phantom.},m_2^{\phantom.}$ with $m = m_1^{\phantom.} m_2^{\phantom.}$. But then $m_2^3 \equiv 2 \bmod 9$, which is impossible. (The solution $(m,n) = (0,0)$ escapes because in that one case the factor $10^k-1$ is zero so there's no condition on $10^k+1$. We could also have used descent, since $10^k-1 = 9m_1^3$ would be a smaller solution of the same Diophantine equation; the solution $(m,n) = (0,0)$ escapes this argument because $k=0=n$ so the new solution is no smaller.)

The hard case is $n$ odd. For $n=1$ we obtain the known solution $(m,n)=(1,1)$; and there is no solution with $n=3$ because $R_3 = 111$ is not a cube. We may thus suppose $n \geq 5$, and write $n = 2k+3$ with $k$ a positive integer. Now we take the strange step [see comment at bottom] of adding $9$ to both sides of the equation $9m^3 = 10^n - 1$, and writing the result as $$9(m+1)(m^2-m+1) = 9m^3 + 9 = 10^n + 8 = 10^{2k+3} + 8 = 8 \left(125(10^k)^2 + 1 \right).$$ Thus if $p$ is any odd prime factor of $m+1$ then $p \neq 5$ and $25 \cdot 10^k$ is a square root of $-5 \bmod p$, so $(-5/p) = +1$ and by quadratic reciprocity $p$ is one of $1,3,7,9 \bmod 20$.

As usual, this set of residues $\bmod 20$ is closed under multiplication, so we conclude that any odd factor of $m+1$, prime or not, is one of $1,3,7,9 \bmod 20$. In particular this is true of $(m+1)/2^f$, where $2^f$ is the largest power of $2$ dividing $m+1$.

But since $n > 3$ (this is how the solution $(m,n)=(1,1)$ escapes the coming contradiction) we have $f=3$ because $125(10^k)^2+1$ is odd (as is the complementary factor $9(m^2-m+1)$ on the left-hand side). Moreover, once $n \geq 5$ we have $R_n \equiv 11111 \equiv 7 \bmod 2^5$, so the putative cube root $m$ of $R_n$ would be $23 \bmod 2^5$, making $(m+1)/8 \equiv 3 \bmod 4$. Since also $m \equiv 1 \bmod 5$ we'd conclude that $(m+1)/8 \equiv 4 \bmod 5$ and thus $(m+1)/8 \equiv 19 \bmod 20$. Since this is not among the four allowed residues we are done. QED

The same approach deals with some other cases of the repunit-power problem, but does not settle it completely. For example, in the decimal case $9m^q+1 = 10^n-1$ has no solution for any $q \equiv 3 \bmod 4$ (using descent to reduce to the case of odd $n$, and then factoring $9(m^q+1) = 10^n+8$ as before). There are no nontrivial solutions for $2|q$ or $5|q$ (by reduction mod $2^2$ and $5^2$ respectively), and $q=9$ is a special case of $q=3$, so $q=13$ is the first exponent (other than $q=1$...) that we cannot exclude this way.

about the "strange step": this feels very artificial, though I'm not familiar enough with the literature on this Nagell-Ljunggren equation or related problems to tell if it's a standard technique. The only other time I remember such a thing working is for a problem that I concocted for the purpose 30+ years ago: Prove that the Diophantine equation $$y^2 = 7x^2+8x-3$$ has no positive integer solutions. There are infinitely many solutions with $x<0$, such as $(x,y) = (-2,3)$, so there's no easy congruence argument (though the problem is routine using the theory of Pell's equation). However, adding $9x^2$ to both sides yields $(3x)^2 + y^2 = (4x-1)(4x+3)$, at which point the two-square theorem soon produces a contradiction (NB if $x<0$ then $\left|4x-1\right|$ and $\left|4x+3\right|$ are $+1 \bmod 4$ !).

-
Hi Noam. Your "strange step" reminds me of V.A. Lebsgue's solution of y2=x3+7, although it's not as elaborate. First note x must be odd, else 7 would be a square mod 8. Then add 1 to get $$y^2+1=x^3+8=(x+2)(x^2-2x+4)=(x+2)((x-1)^2+3).$$ The last factor is 3 mod 4, so is divisible by a prime $q\equiv3\pmod4$. Then $y^2+1\equiv0\pmod{q}$, contradicting the fact that $-1$ is not a square mod $q$. So similar to your solution, he uses only the computation of $(-1|q)$. I don't know the exact reference, but I think that it was late 19th century, so it's not a new idea. –  Joe Silverman May 29 '13 at 3:16
The review by Nikos Tzanakis of Tom Muller, Note on the Diophantine equation $1+2p+(2p)^2+\cdots+(2p)^n=y^p$, Elem Math 60 (2005) 148-149, MR2188007 (2006h:11038), says that the paper uses nothing beyond Fermat's Little Theorem, and that a direct consequence is that no repunit can be a fifth power. Tzanakis says this extends a result of A Rotkiewicz that repunits can't be squares or cubes, but no reference is given. Strangely, when I go to the webpage that should have the Muller paper, it has all the papers from that issue except Muller's. –  Gerry Myerson May 29 '13 at 5:58
The Zentralblatt review of Muller's paper, by Olaf Ninnemann, says more about the Rotkiewicz paper, Elem Math 42 (1987) 76, Zbl 0703.11016; it's not quite so elementary, relying on Ljunggren 1943. –  Gerry Myerson May 29 '13 at 6:01
@Joe Silverman: yes, that's a clear example of the same idea, and much earlier than 1980... Thanks. Here there are no solutions at all, but there still doesn't seem to be an easy congruence argument. (mwrank says there isn't even a rational solution, but doing descents on such a curve isn't elementary either!)  @Gerry Myerson: As I already mentioned, the fact that a decimal repunit other than $1$ cannot be a fifth power is an immediate consequence of the fact that all fifth powers are congruent to $0$, $\pm 1$, or $\pm 7 \bmod 25$. –  Noam D. Elkies May 29 '13 at 14:02
@Wangt Fei: thanks for Accepting my answer, and for pointing out the typo, which I'll fix in the next edit when I also acknowledge other comments and give references to V.Lebesgue's work. For the descent, the idea is that if $n=2k>0$ and $R_n$ is a $q$-th power then the same is true of $R_k$, because $R_k$ is a unitary divisor of $R_n$ (i.e. $R_n/R_k$ is an integer relatively prime to $R_k$). If $k$ is also even then $R_{k/2}$ is a $q$-th power, etc., and eventually we'd reach a solution of $R_n = m^q$ with $n$ odd, to which we can apply the other argument. –  Noam D. Elkies May 31 '13 at 15:55

As expected $(m,n)=(1,1)$ is the only solution in positive integers of the exponential Diophantine equation $10^n - 9m^3 = 1$.

An entirely elementary proof of this seems unlikely because any finite list of congruence conditions on $n$ would have to allow $n=1$ (and also $n=0$, which corresponds to the empty repunit $0$), and thus could not exclude infinitely many other potential $n$.

A routine but non-elementary solution is to reduce to the three cubic Thue equations $p^3-9m^3=1$, $10p^3-9m^3=1$, and $100p^3-9m^3=1$ (where $p = 10^{\lfloor n/3 \rfloor}$), and then use an effective and practical algorithm for solving such equations. gp takes only a few milliseconds to process each of

thue(thueinit(x^3-9),1)
thue(thueinit(10*x^3-9),1)
thue(thueinit(100*x^3-9),1)


and reports that the third equation has no solutions, the second only $(p,m)=(1,1)$, and the first only $(-2,-1)$ and $(1,0)$. Since neither $-2$ nor $1$ is a positive power of $10$ we're done.

P.S. I see that quid linked to a page that in turn includes a link to much the same proof except that the third case (which has no solution) is disposed of by elementary considerations, namely reduction $\bmod 13$ (and as it happens there's a similar proof $\bmod 7$).

-

It is know by work of Bugeaud and Mignotte "Sur l'équation diophantienne $(x^n - 1)/(x-1)=y^q$, II" (see Thm 5) that a repunit in base 10 cannot even be a perfect power (so in particular not a cube).

Another relevant reference is by the same authors "On integers with identical digits" containing among other things the result (Thm 2), which in particular gives all repunits that are perfect powers in all (nontrivial) bases up to $10$:

Let $a$ and $b$ be integers with $2 \le b \le 10$ and $1 \le a \le b-1$. The integer $N$ with all digits equal $a$ in base $b$ is not a perfect power, except for $N=1,4,8,9$, for $N=11111$ written in base $3$, for $N=1111$ written in base $7$, for $N=4444$ written in base $7$.

There are earlier contributions to this problem by others, see the papers for references. (Both papers are freely available online on Bugeaud's webpage http://www-irma.u-strasbg.fr/~bugeaud/publi.html see year 1999)

It seems there was some discussion of this question on the Mersenne forum a while ago http://www.mersenneforum.org/showthread.php?t=16295 for cubes specifically and also a proof was given (scroll down a bit). I did not study it in detail, but if you want just the result for cubes it seems more accessible, yet it also involves solving Thue equations.

Added: The more general questions to classify all repunits (in arbitrary bases) that are cubes or more generally perfect powers is AFAIK open. It is the question for solutions of the Diophantine equation (with $q=3$ for cubes) $$\frac{x^n - 1 }{x-1} = y^q$$ mentioned in the title of the paper mentioned above, called Nagell--Ljunggren equation.

It is conjecture that the set of all non-trivial (i.e., $n,q \gt 1$) solutions $(x,y,n,q)$ is given by $(3,11,5,2)$, $(7,20,4,2)$, and $(18,7,3,3)$, the former two correpond to the two repunits (that are squares) mentioned in the result I recall above, and the third to the repunit in base $18$ that is a cube mentioned by Gerhard Paseman in a comment.

Yet, as said this is open. But there are numerous partial results, for example:

1. no other than the mentioned ones (nontrivial) repunit is a square

2. if there were another cube then it has at least $29$ digits, and the number of digits is a prime and $5$ mod $6$.

In fact in a different terminology, A geometric series equalling a power of an integer, the Nagell--Ljunggren came up a while ago on MO; there some additional informaition and pointers to literature can be found.

-
To reduce the chance of misinterpretation, I highly recommend replacing "such a number" by "a nontrivial base 10 repunit"; otherwise someone else might tell you about 343. Gerhard "Fond Of Repunits And Cubes" Paseman, 2013.05.27 –  Gerhard Paseman May 27 '13 at 18:40
I agree that 'such a number' is not a good way to phrase this (though I would also say that it is hard to see for me how anything else but the $R_n$ in the question could be meant), and will change it shortly (I want to use the edit also to include something else, which I do not want to do just now). –  quid May 27 '13 at 18:49
From my perspective, "such a number" could include either of the expressions in the title of the paper, or the numbers x,n,y, or q referred to in the title. I do not mean to say that your wording is opaque or misleading. I do mean to say that your wording is not bulletproof. Gerhard "Just Trying To Help Protect" Paseman, 2013.05.27 –  Gerhard Paseman May 27 '13 at 19:07
@Gerhard Paseman: I fixed (it is hoped) and expanded it. Thanks for pointing out the confusing formulation. –  quid May 27 '13 at 23:56

$\frac {10^n-1} 9$ is not a cube:

Since a cube is either 0, 1 or -1 mod 9, the number of digits in the repunit is 0, 1 or -1 mod 9.

If the number of digits is -1 mod 9, you can show it's not a cube by reducing mod 19.

If the number of digits is 1 mod 9, reduce mod 7 to show it's not a cube (except for 1).

Suppose $\frac {10^{9n}-1} 9$ is a cube.

$n =2^k m$ where $m$ is odd.

$\frac {10^{9n}-1} 9$ factors as $(10^{2^{k-1}9m}+1)...(10^{9m}+1)\frac {10^{9m}-1} 9$ and the factors are relatively prime, so each must be a cube.

The factors that have a power of 10 plus 1 can't be cubes because a cube + 1 isn't a cube.

Reducing the last factor mod 19, $10^9\equiv -1 (19)$ so $\frac {10^{9m}-1} 9\equiv \frac {-2} 9\equiv 4 (19).$

$4^{18/3}=4^6\equiv 11 (19)\neq 1 (19)$ so this factor also is not a cube.

So the product can't be a cube.

So no repunit base 10 is a cube.

-
If $n=18m+1$ then $(10^n-1)/9$ is $1 \bmod 7$, which is a cube. –  David Speyer Sep 10 '13 at 14:26
More generally, for any modulus $M$ relatively prime to $3$, if $n \equiv 1 \bmod \phi(M)$, then $(10^n-1)/9 \equiv (10-1)/9 \equiv 1 \bmod M$, so there is always an arithmetic progression where $M$ cannot be used to prove $(10^n-1)/9$ is prime. –  David Speyer Sep 10 '13 at 14:29