Originally posted by EricDraven:
I'm stuck with a problem. Either there's no solution or I haven't got it.
Problem
1 2 3 4 5 = 20
Insert + - x / between the numbers without changing the order of the numbers. Each sign must be used at least once and only once (no order assigned for use of the signs). Brackets can be used.
How can we get the equation to be = 20?
---------------------------------------------------------------------------------------------
I'm not very clever or intuitive so I'm going for a brute-force method of exhausting all possible arrangements.
First cut:
There can be 4x3x2x1 = 24 different permutations for the order of the 4 operators (+-x/).
A simple check would show that without using brackets, none of the 24 permutations will give a result equal to 20.
Hence, the key thing is the brackets, which, unfortunately, is so much trickier.
I don't know how to compute the total number of meaningful permutations for the order of the brackets. So I manually list them.
One bracket
1. (1 2) 3 4 5
2. (1 2 3) 4 5
3. (1 2 3 4) 5
4. 1 (2 3) 4 5
5. 1 (2 3 4) 5
6. 1 (2 3 4 5)
7. 1 2 (3 4) 5
8. 1 2 (3 4 5)
9. 1 2 3 (4 5)
Two brackets (exclusive)
10. (1 2)(3 4) 5
11. (1 2) 3 (4 5)
12. (1 2)(3 4 5)
13. (1 2 3)(4 5)
14. 1 (2 3)(4 5)
Two brackets (overlapping)
15. ((1 2) 3) 4 5
16. (1 (2 3)) 4 5)
17. ((1 2) 3 4) 5
18. ((1 2 3) 4) 5
19. (1 (2 3) 4) 5
20. (1 2 (3 4)) 5
21. (1 (2 3 4)) 5
22. 1 ((2 3) 4) 5
23. 1 (2 (3 4)) 5
24. 1 ((2 3) 4 5)
25. 1 ((2 3 4) 5)
26. 1 (2 (3 4) 5)
27. 1 (2 (3 4 5))
28. 1 (2 3 (4 5))
29. 1 2 ((3 4) 5)
30. 1 2 (3 (4 5))
Three brackets
31. (1 2)((3 4) 5)
32. (1 2)(3 (4 5))
33. ((1 2) 3)(4 5)
34. (1 (2 3))(4 5)
35. ((1 2)(3 4)) 5
36. 1 ((2 3)(4 5))
37. (((1 2) 3) 4) 5
38. 1 (((2 3) 4) 5)
39. 1 (2 (3 (4 5)))
40. (1 (2 (3 4))) 5
41. (1 ((2 3) 4)) 5
42. 1 ((2 (3 4)) 5)
43. 1 (2 ((3 4) 5))
44. ((1 (2 3)) 4) 5
That's all I can think of so far. If my universe of bracket permutations is complete, i.e. there can only be 24x45=1080 various ways we can arrange the 4 operators and brackets.
And so far, none of these 1080 permutations produced a result equal to 20.
There can only be two reasons:
1) There is no solution to this problem, i.e, can never achieve 20
2) My universe of bracket permutations is incomplete. Hence, here's where I need some help. Can anyone think of a meaningful bracket permutation for the 5 numbers with 4 operators which I haven't thought of?
I think the answer is (2), there must be some brackets that are missing, please keep trying!!!