# x⌊x⌊x⌊x⌋⌋⌋ = 2020

Solve for $$x$$: $$x \left\lfloor x \left\lfloor x \left\lfloor x \right\rfloor \right\rfloor \right\rfloor = 2020.$$

The floor function $$\left\lfloor t \right\rfloor$$ has the usual “greatest integer $$\leq t$$” definition.

Attribution pending From Michael Penn’s Solving a crazy iterated floor equation video. He proposes four slight variations of the problem at the very end.

• Great puzzle! I started my mathematical answer before the programming answer was posted, and continued on even after it was accepted. I didn't click the link. May 4, 2020 at 20:48
• The plot of $$x \left\lfloor x \left\lfloor x \left\lfloor x \right\rfloor \right\rfloor \right\rfloor$$ looks pretty interesting May 5, 2020 at 13:27
• Is x y here multiplication or function application? If x is a function, then x = const 2020 should work.
– Vi.
May 5, 2020 at 14:53
• A very similar problem appeared in a recent HMMT GUTS round (2017 iirc?) May 5, 2020 at 18:08
• May 5, 2020 at 20:48

$$x=-\frac{2020}{305}=-\frac{404}{61}$$

Explanation:

Firstly, let's notice that $$x$$ multiplied by an integer gives $$2020$$, so we have $$x=\frac{2020}{\alpha}$$ for some integer $$\alpha$$. Since $$6^4=1296<2020<2401=7^4$$, the value of $$|x|$$ must be between $$6$$ and $$7$$ (that's because the function is increasing for positive $$x$$ and decreasing for negative $$x$$). So, $$|\alpha|$$ must be between $$288$$ and $$337$$. Now we just can bruteforce all values using simple Python code: Try it online! and find $$\alpha=-305$$, the only suitable value.

• A better Python code
– Wood
May 6, 2020 at 7:43
• @Wood - why do you think that your code is better?
– Yan
May 6, 2020 at 8:52
• @Yan It finds only exact solutions, because it uses fractions instead of floats. It works for other values besides 2020. It works for different number of nested floor functions. It automatically calculates the minimum and maximum denominators. It prints the result as a non-simplified fraction, the simplified one, and as a decimal representation. It's also relatively fast, compact, easy to understand, and easy to adapt to other similar cases.
– Wood
May 6, 2020 at 10:17
• I can't see how it is any faster (especially as both use Python and are therefore very slow) nor how it is any easier to understand (hides the logic behind product((-1, 1), range(d_min, d_max + 1)) and other such stuff that takes precious seconds of thinking to decipher) nor how it is any more compact (twice as long) nor how it is significantly easier to adapt (changing 2020 or 3 isn't "adapting to a similar case" - it's the same problem). May 6, 2020 at 11:28
• @mypronounismonicareinstate I didn't say it's faster, I said it's also relatively fast. My computer is very slow and it runs almost instantly. The product is a standard way of getting rid of nested for loops, and its use here is not necessary, it's just a matter of taste. Changing 2020 or 3 on the original code completely breaks the script. But what matters the most is that it's not clear that the original code gives an exact answer.
– Wood
May 6, 2020 at 12:18

Observations to give lower and upper bounds:

1. $$\lfloor x\rfloor\leq x$$, so we must have $$2020=x \left\lfloor x \left\lfloor x \left\lfloor x \right\rfloor \right\rfloor \right\rfloor\leq x^4$$, therefore $$x\geq\sqrt[4]{2020}=6.704$$

2. If $$x\geq7$$, then $$x\lfloor x\rfloor\geq49$$ and so on until $$2020=x \left\lfloor x \left\lfloor x \left\lfloor x \right\rfloor \right\rfloor \right\rfloor\geq 7^4=2401$$. Contradiction.

So we know for sure

$$x$$ is six point something and $$\lfloor x\rfloor=6$$. Also $$6.704\leq x<7$$ means $$40.224\leq6x<42$$, so $$\lfloor x\lfloor x\rfloor\rfloor$$ must be either $$40$$ or $$41$$.

Now the whole thing becomes

$$2020=x \left\lfloor x (40\text{ or }41) \right\rfloor$$. The thing inside this final floor sign is at least $$40\times6.704=268.16$$ and at most $$41\times7=287$$. Which means $$x$$ must be at least $$2020\div287=7.038$$.

Contradiction ... and now I realise my implicit assumption that

$$x\geq0$$.

Going back to those two observations at the beginning,

with the knowledge that $$x$$ is negative, we have $$x\geq-6\Rightarrow\lfloor x\rfloor\geq-6\Rightarrow x\lfloor x\rfloor\leq36\Rightarrow x\lfloor x\lfloor x\rfloor\rfloor\geq-216\Rightarrow x\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor\leq 1296,$$ $$x\leq-7\Rightarrow\lfloor x\rfloor\leq-7\Rightarrow x\lfloor x\rfloor\geq49\Rightarrow x\lfloor x\lfloor x\rfloor\rfloor\leq-343\Rightarrow x\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor\geq 2401,$$ $$\lfloor x\rfloor\leq x\Rightarrow x\lfloor x\rfloor\geq x^2\Rightarrow x\lfloor x\lfloor x\rfloor\rfloor\leq x\lfloor x^2\rfloor\leq x^3\Rightarrow 2020=x\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor\geq x^4,$$ so $$-6.704\leq x<-6$$ and $$\lfloor x\rfloor=-7$$.

That means $$42 and $$43\leq\lfloor x\lfloor x\rfloor\rfloor\leq46$$.

That means $$-308.38\leq x\lfloor x\lfloor x\rfloor\rfloor<-258$$.

So we seek a number which,

when multiplied by an integer between $$258$$ and $$308$$, gives $$2020$$. Dividing $$2020$$ by $$6$$ and $$7$$ gives that this integer must be between $$289$$ and $$336$$. Going the other way, the bound of $$308$$ means $$x\geq-\frac{2020}{308}=-6.558$$. Since this bound came from taking the fourth root, we expect $$x$$ should be close to it.

So we try just a few nearby values of the integer:

$$x=-\frac{2020}{308}=-6.558\Rightarrow x\lfloor x\rfloor=7\times6.558=45.909\Rightarrow x\lfloor x\lfloor x\rfloor\rfloor=-45\times6.558=295.13$$, too small.

$$x=-\frac{2020}{307}=-6.580\Rightarrow x\lfloor x\rfloor=7\times6.580=46.059\Rightarrow x\lfloor x\lfloor x\rfloor\rfloor=-46\times6.580=302.67$$, too small but much closer!

$$x=-\frac{2020}{306}=-6.601\Rightarrow x\lfloor x\rfloor=7\times6.601=46.209\Rightarrow x\lfloor x\lfloor x\rfloor\rfloor=-46\times6.601=303.66$$, too small.

$$x=-\frac{2020}{305}=-6.623\Rightarrow x\lfloor x\rfloor=7\times6.623=46.361\Rightarrow x\lfloor x\lfloor x\rfloor\rfloor=-46\times6.623=304.66$$, exactly right!

And we have the solution,

$$x=-\frac{2020}{305}=-6.623\dots$$

Let us denote $$\aleph(x)=x\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor\,.$$Since the fourth root of $$2020$$, $$\sqrt[4\,]{2020}$$, is located between 6 and 7, the solution $$x^\star$$ is either $$x^\star=6+ε$$ or $$x^\star=-7+ε$$, with $$ε \in (0,1)$$. The puzzle then becomes solving either

\begin{align}\aleph(6+ε) &=(6+ε)⌊(6+ε)⌊(6+ε)⌊6+ε⌋⌋⌋\\ &= (6+ε)⌊(6+ε)⌊36+6ε⌋⌋ \\ &= (6+ε)⌊(6+ε)(36+⌊6ε⌋)⌋ \\&= 2020\end{align}

where there are 6 possible integer values for $$⌊6ε⌋$$, with only $$⌊6ε⌋=5$$ being possible, since $$\aleph(6+\frac{5}{6})<2020$$, turning the equation into

$$(6+ε)⌊41(6+ε)⌋ = (6+ε)(246+⌊41ε⌋) = 2020$$

where again only $$⌊41ε⌋=40$$ being possible, as $$\aleph(6+\frac{40}{41 })<2020$$, ending up with

$$1716+286ε = 2020$$

which has no solution in $$(\frac{40}{41},1)$$.

Hence, moving to the alternative case \begin{align}\aleph(-7+ε) &=(-7+ε)⌊(-7+ε)⌊(-7+ε)⌊-7+ε⌋⌋⌋\\ &= (-7+ε)⌊(-7+ε)(49+⌊-7ε⌋)⌋ \\&= 2020\end{align}

shows that only $$⌊-7ε⌋=-3$$ is possible, since

$$\aleph(-7+\textstyle{\frac{2}{7}})>2020>\aleph(-7+\textstyle{\frac{3}{7}})$$

$$(-7+ε)⌊46(-7+ε))⌋ = (-7+ε) (-322+⌊46ε⌋)=2020$$

with only $$⌊46ε⌋=17$$ possible, as

$$\aleph(-7+\textstyle{\frac{17}{46}})>2020>\aleph(-7+\textstyle{\frac{18}{46}})$$

hence

$$2135-305ε=2020$$

and

$$ε=\frac{115}{305}$$

meaning

$$x^\star=-7+\frac{115}{305} = -\frac{2020}{305}$$

• Aren't you missing a 7 somewhere in the last equation ? May 5, 2020 at 16:34
• "(−7+ε)⌊(−7+ε)(49+⌊−7ε⌋)⌋=2020 shows that only ⌊−7ε⌋=−3 is possible" could you explain how you deduce that ? It's not obvious to me. May 5, 2020 at 17:27
• @Xi'an are you the author of the famous xianblog.wordpress.com ? May 7, 2020 at 12:19

A solution which doesn't require brute-forcing with a computer:

(assuming x < 0, since x > 0 turns out to have no solutions)

-7 < x < -6, so ⌊x⌋ = -7

Now we have

x⌊x⌊-7x⌋⌋ = 2020

let x = -7 + p/7, p∈(0,7) (not necessarily an integer)

We can check (by plugging p=2 and p=3 into the original equation) that 2 < p < 3 thus ⌊-7x⌋ = -7(-7+3/7) = 46. Now we have

x⌊46x⌋ = 2020

let x = -7 + q/46, q∈(0,46)

We know that 2 < 7q/46 < 3, meaning 13 < q < 20. Trying a few values, we see 17 < q < 18, which gives us -305x = 2020

(this is not my solution. I rephrased it from the comment here)