Multiply a number by x using only addition. Solved the question, but want to understand how it works?

LukeSwift

New member
Joined
Jun 9, 2019
Messages
3
The first problem was 'multiply a number by 8 using only addition'.

Number 2

2 x 8 = 16

Solution:
2 + 2 = 4
4 + 4 = 8
8 + 8 = 16

The reason I really knew how to do it was the game (Human Resources Machine), asked 'can you solve this question using only three addition steps'? So that gave me a clue to simply add the results of each addition step together, which ended up being the correct answer.

My question is why/how does this work?

The next question was to multiply a number by 40.

Number 2

2+2 = 4
4+4 = 8
8+2 = 10
10 + 10 = 20
20 + 20 = 40

Again here I simply experiment around and got the answer - really from the constraints of only having an addition operator, and just trial and error.

My question is ultimately, to understand why this works (in both cases) so that I can apply the rule in the future to other problems.

Many thanks,
Lukess
 
**Sorry I thought my other post didn't post correctly**


Number 2
x = 8

2 x 8 = 16

2+2 = 4
4+4 = 8
8+8 = 16

The game I am playing (Human Resource Machine) give me a hint, 'use only three addition operations', so I teased the above out. However, why does adding like this give the answer? I know it does hold through for all numbers, for example, the next question was to multiply the number by 40.

Number 2
x = 40

2+2 = 4
4+4 = 8
2+8 = 10
10+10 = 20
20+20 = 40
40+40 = 80

So again, I found this by doing a bit of trial and error, however, I would like to know what it is I'm doing that makes this works, what is the principle underneath I am using to get the correct answer?

Is it something to do with 'the power of', perhaps I just don't understand this mathematically?

Many thanks,
Mark
 
As long as x is a positive integer, xa is equal to "a added to itself x times". Is that what you are talking about?
 
The first idea here is that adding a number to itself is the same as multiplying it by 2. As a result, we can multiply by any power of two by repeated addition to self (doubling).

Multiplying by 8, which is 2*2*2, can be done by repeating that process three times, i.e. adding a number to itself three times:

y = x * 2 = x + x​
z = x * 4 = x * 2 * 2 = y * 2 = y + y​
x * 8 = x * 4 * 2 = z*2 = z + z​

The second idea is that any number can be written as a sum of powers of 2; this is related to the binary number system.

Multiplying by 5, which is 4 + 1, can be done by multiplying by 4 and by 1 and adding:

x * 40 = x * 5 * 8 = x * (4 + 1) * 8 = (x * 4 + x * 1) * 8 = ...​
 
As long as x is a positive integer, xa is equal to "a added to itself x times". Is that what you are talking about?

The first idea here is that adding a number to itself is the same as multiplying it by 2. As a result, we can multiply by any power of two by repeated addition to self (doubling).

Ok, I see, it's very basic when you spell it out. I think this rule 'we can multiply by any power of two by repeated addition to self' is what I'm latching onto, and what I used in both solutions.

The programming challenge said I could only use addition operators, even though it asked me to multiply a number by, 51 say. I can use my initial number at any time to add with, and I could use two other results from my addition results, to add with also (only three numbers can be retained in computer memory.)

Number = 2
51 x 2 = 102

So how do I get 102 from only addition operations?

From what I've learned, I can go 'laterally' (2 + 2 = 4) using my power of two rule, and then I can go 'horizontally', by simply adding my initial number with the result of my first calculation, 4, so 2 + 4 = 6. I can then either go horizontally again, by adding either 2, 4, or 6 to each other, or I could go laterally again by 6+6 = 12 (6^2).

I would keep performing some combination of the above two operations until I get to 102.

Does this make sense?

Is there a better/quicker way to multiply a number by x, without actually using multiplication?

Are the above 'lateral', and 'horizontal' operations, the only moves I have available with all I have an addition operator?

Many thanks for your responses.

Lukess
 
I'm not sure you have yet stated the entire problem exactly as given to you, as we ask in our submission guidelines. It's not clear whether this is a "programming challenge" for which you have to write a general program in some language, or just a game asking you to find an expression for a particular computation, or something else. Please tell us all about it.

If you are saying here that you have to write a single expression the yields 102, with only the number 2 and three addition operators, I believe that's impossible.
 
If you have a programming challenge I'm assuming you need to write a program that multiplies input numbers using only addition. Looks like a good use case for the loop control statement.
Or is the problem to come up with fewest additions to get the given result?
Please clarify.
 
Top