24 Puzzle

Pages: 12
Oct 31, 2011 at 3:01pm
closed account (1vRz3TCk)

-=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=-
Please DO NOT post the answer to this thread.
-=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=-


It took me a while to solve this so I thought I would post it here. It would be nice if you don't post the answer.

How do you make 24 from 1, 3, 4, and 6 using all numbers and only addition, subtraction, multiplication and/or division?

PS please post other puzzles if you have any.

I'm also wondering if there is an elegant generics algorithm for solving the above type of puzzle.
Last edited on Oct 31, 2011 at 3:12pm
Oct 31, 2011 at 3:15pm
closed account (1yR4jE8b)
can you use a number more then once?
Last edited on Oct 31, 2011 at 3:16pm
Oct 31, 2011 at 3:19pm
closed account (1vRz3TCk)
No, each number has to be used once and only once.

For an example, with the numbers 4,7,8,8, a possible solution is the following:
( 7 - ( 8 / 8 ) ) * 4 = 24.
Last edited on Oct 31, 2011 at 3:27pm
Oct 31, 2011 at 3:44pm
I presume we're allowed fractional results and aren't restricted to integer division? If I'm wrong them I'm really baffled as to what the solution could be but I've got it otherwise
Oct 31, 2011 at 3:51pm
closed account (1vRz3TCk)
I presume we're allowed fractional results
obviously the end result has to be 24 but yes intermediate results can be fractional.


The aim of this type of puzzle is to do it in you head, so it is simple maths.
Oct 31, 2011 at 5:50pm
got it.

EDIT:
Did you get this puzzle from "Hacking - The Art of Exploitation" ?
Last edited on Oct 31, 2011 at 5:51pm
Oct 31, 2011 at 6:23pm
closed account (1vRz3TCk)
Did you get this puzzle from "Hacking - The Art of Exploitation" ?
No, a friend posed it. (I don't know where he got it from though). I quite like this type of puzzle (using four number to make 24), I have in the past used four ten sided dice to give me random numbers and then try to make 24 without knowing if it is possible.
Oct 31, 2011 at 11:15pm
Are there only one solution to this? I think I bruteforced all possible combinations, I'm just not sure.
I would be interested in clever algorithms too, but I don't think it exists. Anyway, my bruteforce 'algorithm' has to check 5184 combinations, which is not too much.
Nov 1, 2011 at 12:28am
closed account (zwA4jE8b)
Fun one, I remember seeing this a while back.
Nov 1, 2011 at 12:49am
A program to solve/create these type of problems would be pretty cool :P
Nov 1, 2011 at 10:31am
closed account (1vRz3TCk)
Are there only one solution to this?
I don't know how many solutions there are, I stooped at one. ;0)
Nov 1, 2011 at 2:41pm
Well I'm baffled. Mainly because of quirkyusername's hint

I presume we're allowed fractional results and aren't restricted to integer division?


I'm failing to see how division could be used in a solution, other than to throw out the 1.

I mean both 6*4/3 and 6*3/4 put you well under 24.

Even if you add 1 to the numerator to push it up as high as possible, dividing still leaves you way short of the goal:

6*(4+1)/3 = 10
6*(3+1)/4 = 6

The way I see it, 6 has to be somehow involved in a multiplication (either before or after you add to it). There's no way to get up to 24 otherwise. But I can't seem to figure it out. Closest I can get is 25.
Last edited on Nov 1, 2011 at 2:50pm
Nov 1, 2011 at 2:51pm
@Disch

here's an even bigger hint, if you want to solve it yourself don't read below...











remember that dividing by a fraction is equivalent to multiplication
Nov 1, 2011 at 3:00pm
Well yeah -- but that doesn't really make sense. There's still division involved.

I mean x/(y/z) is the same as (x*z)/y. So either way you have a division by y. So unless y is 1 and you're just dividing by it to throw it out, that division seems to make it impossible to get up to 24. Even if you multiply every other number.

I'm not doubting you. I mean I'm sure there's a solution. I'm just not seeing it.

EDIT: I should also mention I'm bad at these kinds of puzzles. =P
Last edited on Nov 1, 2011 at 3:05pm
Nov 1, 2011 at 3:06pm
closed account (1vRz3TCk)
Would you like me to PM the answer?
Nov 1, 2011 at 3:08pm
yes plz =P

EDIT: pft, of course now that I see the solution I get it XD. But yeah I probably never would have gotten it.
Last edited on Nov 1, 2011 at 3:14pm
Nov 1, 2011 at 3:22pm
I probably wouldn't have gotten it if I hadn't been practicing this sort of thing so much recently, I've had several job interviews for programming positions and problem solving puzzles crop up a lot.

EDIT - I might make a post full them actually
Last edited on Nov 1, 2011 at 3:23pm
Nov 1, 2011 at 5:20pm
I found 2 more solutions (by now, but I will not expand it)
Hint: 6*9 = 42
Nov 1, 2011 at 6:34pm
what? 6*9 = 54, and I can't see how that would get us any closer to 24
Last edited on Nov 1, 2011 at 6:39pm
Nov 1, 2011 at 9:06pm
Haha, I had one of these in a math class where the solution was just to add up all of the numbers, and it took most people a good 15 minutes :)

Back to work anyhow, I'm assuming its not (6*4) + 1/3 and letting python truncate the decimal :/
Last edited on Nov 1, 2011 at 9:31pm
Pages: 12