This is inspired by this and this and more similar ones.

Let us consider formation of a given positive integer N by the following rules

  1. You may use only one digit, which one is your choice and you may use it multiple times, though the fewer times the better
  2. You may use the following arithmetic operations: exponentiation, multiplication, division, addition, subtraction and unary minus; the order is your choice, in other words you are allowed parentheses but only for grouping (no binomial coefficients and other shenanigans)
  3. You may use concatenation but only of the raw digit you chose, for example if you chose 7 you can make 777 but you can't make 17 = 7/7 concat 7 ; and no decimal point

The task is usually to find an expression for N by the rules above involving the minimum number of digits.

Now, given rule 3 asking for a number like N=3333 or N=111 would be rather boring, or wouldn't it?

The question I'm asking is:

Which is the smallest number whose decimal representation xx...xx is formed from a single digit x but has an optimal formation by the above rules that is not based on x but on a different digit.


Same question but additional requirement optimal formation must have fewer digits than decimal representation.

Example: 99999999999 (11 9's) can be written (11-1)^11-1 which is only 6 1s. This is not the smallest example, though.

Note 1: this is brute-forceable with a computer, but if someone can come up with a paper and pencil solution that would be preferred.

Note 2: please let me emphasize the absence of the tag.

  • 1
    $\begingroup$ If the formulation uses an equal number of digits, does that count or does it have to be strictly less than if it were based on x? $\endgroup$
    – hexomino
    Dec 21, 2020 at 19:09
  • $\begingroup$ @hexomino same number is ok. I'll make the strictly less a bonus. $\endgroup$ Dec 21, 2020 at 19:19
  • 1
    $\begingroup$ Note that "optimal formation by the above rules that is not based on x" means that your example would be wrong if there would be a formulation with 6 resp. 5 nines . Did you indeed mean that, or are you 'only' asking for <=/< number of digits in decimal notation? $\endgroup$
    – Retudin
    Dec 22, 2020 at 9:28
  • $\begingroup$ @Retudin I did mean as I wrote but I'm no longer convinced it was good puzzle design (puts too much emphasis on the demonstrate optimality bit which is probably tricky and unrewarding...) As a matter of fact I restricted the set of allowed operations to keep at least a computerized brute force proof in the realm of the possible. Which is a shame because it seems to have killed any scope for more creative solutions. $\endgroup$ Dec 22, 2020 at 9:39

4 Answers 4


All possible ways to start using one operation (two instances of $x$) are: $0,1,2x,x^2,x^x,11x$.

I've built on top of $x^x$ to get a four digit number:


  • $\begingroup$ This is rather cool, not relying on the boring ol' 10^n-1 pattern! $\endgroup$ Dec 23, 2020 at 6:54

I have found a number can be achieved by using the same number of another digit, kind of based on OP's example

$99999 = (5+5)^5-\frac{5}{5}$

Stretching this a bit, the best I've managed so far for the bonus is

$99999999 = \left( \frac{88-8}{8} \right)^8 - \frac{8}{8} $


Following @Vepir's answer, this is an attempt to understand if this solution is unique or if we can expect other similar solutions.

So what we need to get a handle on is why 1111 divides 6^5+1; in other words, why 6^5 = -1 mod 1111. The first thing to observe is 1111 = 11x101 with 11 and 101 prime numbers. Time for Fermat: n^10 = 1 mod 11 and n^100 = 1 mod 101 for n relatively prime to 11 or 101, respectively, but for any given n the minimal power sending n back to 1 (the "order" of n mod 11/101) can be any divisor of 10/100. We note that 10 and 100 have the same prime factors which is a rather helpful but not a crazy coincidence. Another minor coincidence, then, is that the order of 6 mod 11 and 101 is 10 in both cases. Therefore 6^5 must square to 1 but not equal 1, i.e. it must equal -1 mod 11 and 101 and therefore 1111.

So we needed a little bit of luck for 1111 to divide 6^5+1. While it doesn't look insanely improbable, it seems unlikely to scale with the number of digits. Indeed, checking with computer algebra up to 20 1s didn't yield any analogous cases.

So it---sadly---looks like a one-off.


My answer is

$(\frac{777-77}{7})^7 -\frac{7}{7}=99999999999999$

  • $\begingroup$ A solution using less digits has already been found - Vepir's answer, with four digits. Please don't add another answer unless you can improve on that. $\endgroup$
    – bobble
    Dec 26, 2020 at 4:33
  • $\begingroup$ @ bobble. I produce with 9 digits a 14 digit number which is the best result so far.What do you mean when you say to improve on that? $\endgroup$ Dec 26, 2020 at 5:00
  • $\begingroup$ The question asks for the smallest number you can form, and additionally asks you to minimize the digits used to form said number. You have formed a larger number from more digits. That is against both conditions. $\endgroup$
    – bobble
    Dec 26, 2020 at 5:04
  • $\begingroup$ My numbers produce the ratio 14/9=1.555 all the other solutions produce smaller ratios.I thought that was the meaning of the question.I can produce an answer with ratio 7/7=1. $\endgroup$ Dec 26, 2020 at 5:23
  • 1
    $\begingroup$ That does not use digits, it uses numbers (10). Therefore it is invalid. I think you are misinterpreting the problem and have no interest in continuing these comments. Good day. $\endgroup$
    – bobble
    Dec 26, 2020 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.