# How to make the number 49?

You've to start with $$1$$ and can use each of the following operations at most once. You can do the following in any order you like:

1) Add $$2$$.

2) Add $$3$$.

3) Add $$5$$.

4) Multiply $$2.$$

5) Multiply $$3.$$

6) Multiply $$5$$.

How to make the number $$49?$$

You can do:

+3 [->4], x5 [->20], +2 [->22], x2 [->44], +5 [->49].

• Not even 20 minutes :p – Avi Oct 25 '19 at 18:34
• @Avi It is fairly easy to solve quickly if you do it backwards, starting from 49 and working back to 1. – Jaap Scherphuis Oct 25 '19 at 21:17
• It looks like the question OP asked is from the ongoing competetion in.bricsmath.com/students/tours/trial/tasks/trial_tour_card_1. Although it is still a trial round , the site provides no answer or explanation to the solution and I believe that outside help should not be provided as long as the competition is active. – The Demonix _ Hermit Oct 29 '19 at 7:08
• Ah, crap. I did wonder whether it was an original puzzle or not, but it seemed like the sort of thing the OP could easily have made up. Maybe we need to have a policy of just always asking that question for new PSE users unless it's super-duper-obvious. The bricsmath site says "The results of the trial round do not affect the main round." so I don't think it does much harm to leave this here; anyone looking up the answer here rather than solving it themselves isn't harming anyone else. – Gareth McCaughan Oct 29 '19 at 10:35

As @Jaap commented, the simplest way to move forward is to

start at 49 and invert the listed operations.

So let's go spelunking!

The most obvious thing is that no division step can take place first. Therefore, we must start by subtracting.

Subtracting by 2 is a non-starter, since this generates 47.

This limits us again to a subtraction step, making 44 [-3] or 42 [-5].
44 goes to 39 [-5], which only grants 13 [/3] and then ends, or 22 [/2], which also ends after 17 [-5]. From this, we realize that hitting 44 with [-2 and -3] or 39 with all subtraction steps is an effort in futility, so we'll avoid those chains.
42 goes to 39 [-3] (covered above), 21 [/2], or 14 [/3]
21 goes to 18 only [-3], which only grants 6 [/3] and ends.
14 goes to 7 [/2], which only grants 4 [-3] and ends.

Now starting with subtracting by 3,

46 goes to 44 [-2], 41 [-5], or 23 [/2]. 41 immediately ends, as a prime and as a direct result of the only possible remaining move [-2] yielding 39 with all subtraction steps. As such, we'll ignore 41 if it comes up again.
23 goes to 18 [-5] or 21 [-2], which ends after 2 steps: 7 [/3] and 2 [-5]. So close!
18 goes to 16 [-2], which ends since we only have [/3] or [/5] left, or 6 [/3], which also ends with [/5] left.

And finally subtracting by 5 for our first step.

44 is a decent starting point, since we still have [-2] and [-3] available. Let's take this a little bit slower, since this is likely to yield a lot more potential steps.

[/2] gives 22, which goes to 20 [-2] or 19 [-3].
20 goes to 17 [-3], which ends with only [/3] and [/5] left, or 4 [/5]. The only feasible move is [-3], which gives 1. Success! [/3] left over.
19 goes to 17 [-2], which is ruled out above. [-2] gives 42, which is the same case as in the first description. [-3] gives 41. No thanks.

Therefore, the only feasible solution is

-5, /2, -2, /5, -3. Or, going from 1 to 49, +3, *5, +2, *2, +5.

Looks like @Gareth really knew what he was doing!

A solution in python (because https://www.xkcd.com/353/)

import itertools

ops = []
ops.append(lambda t: t + 2)
ops.append(lambda t: t + 3)
ops.append(lambda t: t + 5)
ops.append(lambda t: t * 2)
ops.append(lambda t: t * 3)
ops.append(lambda t: t * 5)

for r in range(len(ops)):
for subset in itertools.combinations(ops, r):
for p in itertools.permutations(subset):
res = 1
rec = []
for op in p:
res = op(res)
rec.append(ops.index(op))
if res == 49:
print(res, rec)


This prints:

49 [1, 5, 0, 3, 2]


Where 49 is the result, and [1, 5, 0, 3, 2] is the list of operations applied (to 1) (indices starting from 0 of course).

This code:

<script>

a=[];
st=6;
for (let i=0;i<st;i++) {
a.push(new Array(st).fill(0));
a[a.length-1][i]=st;
}
while (st>1) {
b=[];
st--;
for (let i=0;i<a.length;i++) {
tmA=[];
for (let j=0;j<a[i].length;j++) if (a[i][j]==0) tmA.push(j);
for (let j=0;j<st;j++) {
var nwA=a[i].slice(0);
nwA[tmA[j]]=st;
b.push(nwA);
}
}
a=b.slice(0);
}

x=['+2)','+3)','+5)','*2)','*3)','*5)'];
c=[];
for (i=0;i<720;i++) {
str='((((((1';
for (j=0;j<6;j++)
str+=x[a[i][j]-1];
c.push(str);
}

for (i=0;i<720;i++) {j=eval(c[i]);if (j==49) console.log(j);console.log(i+' : '+c[i]+' = '+j);}

</script>


proves that there are no solutions using all 6 operations.

Changing st to $$5$$ in the first part, and the last part of the code to:

x=['+2)','+3)','+5)','*2)','*3)','*5)'];
c=[];
for (let k=0;k<6;k++) {
for (let i=0;i<120;i++) {
str='(((((1';
for (let j=0;j<5;j++)
str+=x[a[i][j]-1];
c.push(str);
}
x.unshift(x.pop());
}


finds:

(((((1+3)*5)+2)*2)+5) = 49

as the only solution with 5 operations.

• No, you cannot use brackets on the numbers used in the operations. (2 ADD 5) is not allowed. – Tapi Oct 25 '19 at 18:30
• This should probably be a comment. – Ryan Veeder Oct 25 '19 at 20:58