Write 24 using the four numbers 1, 3, 4, 6 and basic arithmetic.


  1. The given are numbers, not digits, so you can't group them using decimal notation. For example, you can't create the number 6431.

  2. Only one occurrence of each number is allowed. For example, you can't write $24 = 6 + 6 + 6 + 6$.

  3. All numbers have to be used.

  4. Basic arithmetic means only the 4 operations: $+$, $-$, $\times$, $/$. Also parentheses $(\dots)$ are allowed to set the order of operations.

  • $\begingroup$ I have a feeling the solution has something to do with decimals and not just integers, but that's as far as I've gotten so far. $\endgroup$ – Doorknob Jun 9 '14 at 16:45
  • $\begingroup$ I had this puzzle once, when I was in grade 9 at a math camp. $\endgroup$ – Joe Z. Jun 9 '14 at 17:49
  • 1
    $\begingroup$ @klm123, Why not just bruteforce it? $\endgroup$ – Pacerier Jun 9 '14 at 22:12
  • $\begingroup$ Is there a way to generalize this problem? By the way, I've seen this question asked in Hacking:the art of exploitation $\endgroup$ – Gabriel Romon Jun 25 '14 at 16:53
  • $\begingroup$ @G.T.R, I have no idea what do you mean by generalization of such type of problem, which have unique and unusual (in some psychological sense) answer. $\endgroup$ – klm123 Jun 25 '14 at 18:35

$\dfrac{6}{1 - \frac{3}{4}}$.

This simplifies to $\frac{6}{1/4}$, which becomes $6 \cdot 4$, which becomes $24$.

| improve this answer | |
  • $\begingroup$ So there's a 5th rule about order of operations? $\endgroup$ – Jason Jun 9 '14 at 23:46
  • 1
    $\begingroup$ parentheses are used to define order of operations :-) $\endgroup$ – mau Jun 10 '14 at 13:53
  • 1
    $\begingroup$ @Jason, that's a valid question. I corrected the condition to allow them explicitly. $\endgroup$ – klm123 Jun 10 '14 at 17:33

This boils down to the same solution as Kevin's, but uses Reverse Polish notation.

6   1   3   4   /   -   /   =>   24

Notice the elegance of the notation, the lack of brackets, the lack of different sized fonts, the lack of confusing latex markup to write it, the sheer incomprehensibility of what's actually going on, ... uhm, yeah, apart from that, though.

The contents of the stack at each step:

The operations and the contents of the stack at each step

| improve this answer | |
  • $\begingroup$ Excellent answer, but you need to spell out the point: this makes the problem amenable and optimal for recursion without having to add parentheses and worry about nested parsing of open-close parentheses. Recursion simply has to consider all legal string combinations of numbers and the four arithmetic operators. (Order is obviously significant) $\endgroup$ – smci Jun 4 '17 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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