# A puzzle about baking 88 pies

You surely remember that one of my grandmothers really hates mathematics (How do I convince my grandmother?).

Yesterday I visited my other grandmother who really loves mathematics. She was in the middle of preparing 88 cherry pies for the church fair on sunday, and she did not have much time for anything else. To keep me busy, she posed me a small riddle that also has to do with 88 pies (as she claimed):

Find all positive real numbers x with $x\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor=88$.

(The puzzle uses the floor function $\lfloor x\rfloor$ which rounds x down to the next integer below x.)
What is the answer to grandmother's puzzle, and how does it relate to cherry pies?

Answer: the relation to pies is a relation to $\pi=3.14159265359$ (which is commonly pronounced "pie"). The convergents of the continued fractions for $\pi$ are the simplest approximants to $\pi$. The first few are

• $3$ (known to the Babylonians, and also used in the Bible),
• $22/7$ (known to Archimedes and the old Greek),
• $355/113$ (known to Tsu Chung Chih and the old Chinese).

First I guessed $x=\pi$, but then the left hand side is irrational and the right hand side is integer.
My second guess was $x=3$, which does not work either as $88$ is not a multiple of $3$.
My third guess was $x=22/7\approx 3.1429$, and this indeed works:

• Then $\lfloor x\rfloor=3$
• and $\lfloor x\lfloor x\rfloor\rfloor=\lfloor (22/7)\cdot3\rfloor=9$
• and $\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor= \lfloor (22/7)\cdot9\rfloor=28$
• and $x\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor=(22/7)\cdot28=88$.

Hence $x=22/7$ works. There cannot be any other solutions, as the function $f(x)=x\lfloor x\lfloor x\lfloor x\rfloor\rfloor\rfloor$ is strictly increasing on the positive reals; therefore $f(x)<88$ for $x<22/7$ and $f(x)>88$ for $x>22/7$.

You can solve this one without any guessing or knowing anything about pies or rational approximations to $\pi$.

First, you note that you have

x * (integer) = 88


so that $x$ must be a fraction: $88$ over some integer $m$, in fact.
Then you note that $⌊x⌋^4 < x⌊x⌊x⌊x⌋⌋⌋ < x^4 < ⌊x+1⌋^4$. You know that $3^4=81$, and $4^4$ is 256, so we must have $⌊x⌋ = 3$.

This leaves relatively few choices. We know that $m$ must be no more than $29$ as otherwise $88/m$ would be less than 3. We also know it can't be as low as $22$ as otherwise $x$ would be $4$ or more. So we have the following options, which we just calculate out, throwing away anything that is too big or where the final result isn't actually $88$. (We can use the fact that $3 < ⌊x⌋$.)

trial x      x⌊x⌋   ⌊x⌊x⌋⌋ x⌊x⌊x⌋⌋ ⌊x⌊x⌊x⌋⌋⌋      x⌊x⌊x⌊x⌋⌋⌋
88/23        264/23   11   too much, 3*3*11 > 88
88/24=11/3   11       11   too much, 3*3*11 > 88
88/25        264/25   10   too much, 3*3*10 > 88
88/26=44/13  132/13   10   too much, 3*3*10 > 88
88/27        88/9      9   88/3      29           not integer
88/28=22/7   66/7      9   198/7     28           22/7 * (7*4) = 88
88/29        264/29    9   792/29    27           not integer


So, there you have it: 22/7.

(Then you have to remember that it is used as a handy rational approximation to $\pi$.)

We know $x \neq 0$ and $\lfloor x \lfloor x \lfloor x \rfloor \rfloor \rfloor \neq 0$, since their product is nonzero. Therefore we may divide both sides by the nonzero integer $n = \lfloor x \lfloor x \lfloor x \rfloor \rfloor \rfloor$, and we get that $x = \frac{88}{n}$ is rational. So $x = \frac{p}{q}$ for some integers $p, q$, where $q \neq 0$.

Further, $\frac{88}{n} = \frac{p}{q}$ where $\frac{p}{q}$ is in lowest terms, so $p$ is a divisor of $88$. Since $x > 0$, we may assume $p>0$ and $q >0$. Thus $p$ is one of $1, 2, 4, 8, 11, 22, 44, 88$. On the other hand, since $\lfloor x \rfloor > 0$, we have that $1\leq q \leq p$.

This narrows down the choices to $(p, q)$; there are now only $1 + 2 + 4 + 8 + 11 + 22 + 44 + 88 = 15 + 15(11) = 15(12) = 180$ possible pairs to check. (Actually fewer than that, since the same rational number may show up as $p/q$ for various different pairs $(p, q)$.)

The following Python 2.7 code returns the pairs $(p,q) = (22, 7)$, $(44, 14)$, and $(88,28)$, all of which represent fractions that reduce to $22/7$. Note that in Python 2.7, regular division of integers returns the integer quotient (aka the floor of the rational number).

for p in [1, 2, 4, 8, 11, 22, 44, 88]:
for q in xrange(1, p): #no need to check p = q since p/q = 1 is not a solution
frac = 1
for i in xrange(3):
frac *= p
frac /= q
if frac*p == 88*q:
print p,q


In fact, many of these same comments still apply even if we don't assume $x>0$. If we had assumed $x<0$ instead, then clearly $x \leq -1$: Otherwise, $-1 < x < 0$, so $\lfloor x \rfloor = -1$, and in that case $\lfloor x \lfloor x \rfloor \rfloor = \lfloor -x \rfloor = 0$ so the whole product on the left-hand side is $0$. Further, $x = -1$ is not a solution, so $x < -1$. Therefore $x = p/q$ where $p$ is a (positive) divisor of $88$ and $q$ is a (negative) integer such that $-p < q \leq -1$.

Checking these possible pairs yields no solutions, so $x = 22/7$ is the only real solution, positive or negative.