# The Grand Exercise in Following Directions

This is not an original puzzle. This puzzle was created by a really cool TA at my summer math camp, for a puzzle hunt that was started in compensation for a cancelled math tournament. I just thought that it had a really cool concept and would be a nice addition to this community. I also don't remember the complete solution. :P

Here it is:

1. Mastered algebra? Pick a number, and see!
2. Uncomplicated for now: multiply by eighty-three
3. Log base four of your |result|
5. Increase your number by seventy more
6. Plus an additional fifteen, and take the floor
7. Less step thirteen's number: this part is the key!
8. Your next number's the ceiling of division by three
9. Base is two; exponent's your number squared
10. You now kill the fractional part; the integer part's spared
11. 3 is the next number to multiply by
12. Made it this far? Wow, I'm surprised!
13. Obtain a new number by squaring the last
14. Delete the last digit (this step should be fast)
15. 1 is a digit that (to the back) you append
16. 7 you'll add... could this be the end?

Hint?

I can confirm that the order in which my team followed the directions was seriously messed up. I'm also rather sure it had everything to do with the secret message.

• If this puzzle is anything like "giraffe/elephant in the refrigerator," steps 5's and 9's "your number" might refer to step 1's "pick a number" or step 8's "your next number"
– humn
Oct 25, 2016 at 3:47
• I definitely don't think it was that. Oct 25, 2016 at 4:13

Heh, finally (re)cracked it.

The key to this puzzle is this:

Trying to follow the directions in the given order evidently results in some misery. Note that the first letters spell out MULTIPLY BY THREE MOD 17, which gives an ordering for the steps. Starting from 1, the next step we go to is the result of multiplying by 3 and taking the remainder mod 17, and so on. Since 17 is prime, we'll hit all step numbers in our orbit. Indeed, the order is 1, 3, 9, 10, 13, 5, 15, 11, 16, 14, 8, 7, 4, 12, 2, 6.

Now...

Trying to follow the steps still results in some misery, once we get to step 9 things don't seem to simplify that well.

But...

Reading through, step 7 references step 13's number, which comes up fairly early and right after step 10. The result of step 10 is an integer guaranteed, so we may let step 13's result be $$x^2$$ for an integer $$x$$. The hope is that steps 1,3,9 may be skipped.

Now let's roll!

STEP 5: $$x^2+70$$

STEP 15: $$10x^2+701$$

STEP 11: $$30x^2+2103$$

STEP 16: $$30x^2+2110$$

STEP 14: Since $$x^2$$ is an integer, the last digit must be $$0$$, so offing this digit gives $$3x^2+211$$.

STEP 8: Again using that $$x^2$$ is an integer, we deduce that the next multiple of 3 is $$3x^2+213$$, thus the ceiling must be $$x^2+71$$.

STEP 7: The $$x^2$$ vanishes! We obtain $$71$$.

STEP 4: $$89$$

STEP 12: So how's your day going?

STEP 2: $$7387$$

STEP 6: $$\boxed{7402}$$

• Step 1, 3, 9 maybe effectively skipped if "your number" in step 9 refers to x, and so 2^(log_4 (x^2)) = x. Aug 3, 2021 at 1:31
• If this was the setter's intention, then that acrostic clue was wretched -- there was no indication as to what it referred to... could have been another thing to do to the $x$ expression. Or (if we grant that it refers to the steps), 3, 6, 9,..., i.e. $3k\bmod 17$, not $3^k \bmod 17$. // Step 3 yields $\log_4 |x|$. So step 9 cancels this out only with "doubled" instead of "squared" (which of course wrecks the rhyme). Or perhaps step 9 was really "Base is two; exponent's your number. Square." Aug 3, 2021 at 13:52
• I don't think the acrostic is so wretched. I think it's not reasonable to apply it to $x$ because it's a bit wacky. Once we try to use it to rearrange the steps, I think the only logical way is actually the $3^k$ because step 1 is the only opportunity to choose a number, so we must start there. This naturally leads to the $3^k$ idea, combined with the fact that steps 3 and 9 look related (I suspect that they indeed meant for the whole thing to be squared). Multiplying all step numbers by 3 doesn't let you start with step 1. Aug 3, 2021 at 20:17

OK, here goes. No spoilers on the first bit because that would just be too much hassle.

1. $x$
2. $83x$
3. $\log_4(83x)$
4. $\log_4(83x)+a$
5. $\log_4(83x)+a+70$
6. $\lfloor\log_4(83x)+a+85\rfloor$
7. $\lfloor\log_4(83x)+a+85\rfloor-y$
8. $\left\lceil\frac{\lfloor\log_4(83x)+a+85\rfloor-y}{3}\right\rceil$
9. $2^{\left\lceil\frac{\lfloor\log_4(83x)+a+85\rfloor-y}{3}\right\rceil^2}$
10. same (this is $2^n$ where $n$ is a non-negative integer)
11. $3\cdot2^{\left\lceil\frac{\lfloor\log_4(83x)+a+85\rfloor-y}{3}\right\rceil^2}$
12. same
13. $9\cdot2^{2\left\lceil\frac{\lfloor\log_4(83x)+a+85\rfloor-y}{3}\right\rceil^2}$; this has to equal $y$
14. $\left\lfloor\frac{9\cdot2^{2\left\lceil\frac{\lfloor\log_4(83x)+a+85\rfloor-y}{3}\right\rceil^2}}{10}\right\rfloor$
15. $10\left\lfloor\frac{9\cdot2^{2\left\lceil\frac{\lfloor\log_4(83x)+a+85\rfloor-y}{3}\right\rceil^2}}{10}\right\rfloor+1$ (note: there's another way to interpret this step; see below.)
16. $10\left\lfloor\frac{9\cdot2^{2\left\lceil\frac{\lfloor\log_4(83x)+a+85\rfloor-y}{3}\right\rceil^2}}{10}\right\rfloor+8$

Note further that

the initial letters of the steps spell out MULTIPLY BY 3 MOD 17, which perhaps we are supposed to do at the end (though I kinda object: the result of doing that is an integer mod 17, not an integer, and cannot uniquely determine a room number unless there are very few rooms).

Our number $y$ (the result of step 13) is of the same order of magnitude as the final result (very close if "back" in step 15 means the right end; about the same number of digits, at any rate, if it means the left end), which is "a room number"; it is $9\cdot2^{2m^2}$ for some non-negative integer $m$. That is, it is one of: 9, 36, 2304, 2359296, etc. It turns out (though I don't think it particularly matters) that the values 9 and 36 are not possible if $x$ is an integer, because then the result of step 7 has to be large and we get a big value of $m$ that contradicts the small value of $y$.

Aside from that constraint,

let $m$ be any non-negative integer that's $\geq 2$ (this will be the number coming out of step 8). Then I claim that we can arrange for this number to emerge from step 8, and for everything to be consistent, and that each choice of $m$ yields a different final answer (before MULTIPLYing BY 3 MOD 17, anyway). I'll fix $a=18$ here. Then we need $\left\lceil\frac{\lfloor\log_4(83x)+103\rfloor-y}{3}\right\rceil=m$ where $y=9\cdot2^{2m^2}$. Since $m\geq2$, $y\geq2304$. So, we'll make $lfloor\log_4(83x)+103\rfloor-y=3m$ or equivalently $3m+y\leq\log_4(83x)+103\leq3m+y+1$ or $3m+y-103\leq\log_4(83x)\leq3m+y-102$ or $4^{3m+y-103}\leq83x\leq4^{3m+y-102}$. The difference between the lower and upper bounds here is at least $3\cdot4^{6+2304-103}$ which is much, much bigger than 83, so there is an $x$ for which this holds. Hence, we can make stage 8 produce the desired result. And now the final answer we obtain is $10\left\lfloor\frac{y}{10}\right\rfloor+8$ which changes whenever $y$ changes by more than 10. Recalling how $y$ depends on $m$, this is evidently true.

OK, so does it turn out that

the result after MULTIPLYing BY 3 MOD 17 doesn't change when $m$ does? Not quite. In fact the result mod 17 depends on the parity of $m$, because $y$ mod 170 depends only on the parity of $m$. (Proof: easy exercise.) So our final result after MULTIPLYing BY 3 MOD 17 is 5 if $m$ is even, and -5 (or, if you prefer, 12) if $m$ is odd.

So

either there is some other hidden step or constraint, or my calculations have gone astray somehow, or there isn't in fact a unique answer without extra assumptions like the one about the room number.

• I would like to note that we campers were not informed that the result would conveniently be a room number, although we did speculate it might happen to be. If I remember correctly, the youngest adult age we used was 18. Unfortunately, your approach is off track. Oct 21, 2016 at 22:23
• Do you mean there's an actual mistake in it? Oct 21, 2016 at 22:34
• There is no mistake. Oct 21, 2016 at 22:34
• @Deusovi I suggest that you post an answer explaining how you reckon it works. (I expect you're right.) Oct 22, 2016 at 20:25
• @GarethMcCaughan seems like you finally got the answer you requested after 5 years. Haha Aug 3, 2021 at 1:35