# Not so boring numbers

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?

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.

Bonus:

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.

• 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? – hexomino Dec 21 '20 at 19:09
• @hexomino same number is ok. I'll make the strictly less a bonus. – Paul Panzer Dec 21 '20 at 19:19
• 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? – Retudin Dec 22 '20 at 9:28
• @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. – Paul Panzer Dec 22 '20 at 9:39

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:

$$7777=\frac{6^6+6}{6}$$

• This is rather cool, not relying on the boring ol' 10^n-1 pattern! – Paul Panzer Dec 23 '20 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.

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