25

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

Explanations:

  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: +, -, x, /. Also parentheses (...) are allowed to set the order of operations.

bobble
  • 10,245
  • 4
  • 32
  • 80
klm123
  • 16,216
  • 8
  • 64
  • 125
  • 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. – Doorknob Jun 09 '14 at 16:45
  • I had this puzzle once, when I was in grade 9 at a math camp. –  Jun 09 '14 at 17:49
  • 1
    @klm123, Why not just bruteforce it? – Pacerier Jun 09 '14 at 22:12
  • Is there a way to generalize this problem? By the way, I've seen this question asked in Hacking:the art of exploitation – Gabriel Romon Jun 25 '14 at 16:53
  • @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. – klm123 Jun 25 '14 at 18:35

3 Answers3

42

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

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

Will Octagon Gibson
  • 9,220
  • 1
  • 19
  • 98
Kevin
  • 6,449
  • 1
  • 31
  • 30
15

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

ClickRick
  • 1,823
  • 15
  • 28
  • 3
    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) – smci Jun 04 '17 at 23:54
1

$6 \times 4 - 3 - 1$
If numbers are in the octal base.

Pilot
  • 879
  • 7
  • 30