Make $49$ from $1$ and $+2,+3,+5,×2,×3,×5$

87 Views Asked by At

I came across a puzzle. You start with number $1$. You have to add $2,3,5$ and multiply by $2,3,5$. All $6$ operations must be done exactly once. And outcome must be $49$.

Tried many combinations. But closest I came is $48$ or $50$. I suspect that only even number will come out. But I cannot explain.

2

There are 2 best solutions below

1
On

I wrote a Python program to brute-force all possible permutations of the operations and see whether they resulted in $49$:

#!/usr/bin/env python3.7
from itertools import permutations

ops = {"+2": lambda x: x + 2,
       "+3": lambda x: x + 3,
       "+5": lambda x: x + 5,
       "*2": lambda x: x * 2,
       "*3": lambda x: x * 3,
       "*5": lambda x: x * 5}

for perm in permutations(ops.keys()):
    n = 1
    for op in perm:
        n = ops[op](n)
    if n == 49:
        s = "1" + "".join(perm)
        print(s, "= 49")

It returned no solutions. So the problem with $2,3,5$ is unsolvable.


If the fives are changed to fours, however, there is a unique solution: $((1×4+2)×2+3)×3+4 = 49$.

0
On

Here is an approach that goes backwards in order to eliminate possibilities.

First observe that only the operations $2x$, $x+3$ and $x+5$ change the parity, so in order for the result to be odd (with starting value $1$), they must be in relative order $x+3,2x,x+5$ or $x+5,2x,x+3$.

Next we place operations $3x$ and $5x$. The value will be minimized if multiplication is put at the beginning, and we can see if any of $3x$, $5x$ is put after the first addition operation (in the chain we have constructed so far), the value is greater than $49$ for starting value $1$. So we must have $3x$, $5x$, $x+3$, $2x$, $x+5$ or $3x$, $5x$, $x+5$, $2x$, $x+3$.

Finally, we are left with placing $x+2$. If we start by placing it at the end, the value is minimized and smaller than $49$. Moving it further left, the value increases and gets greater than $49$ without being equal, so there is no solution.