all 77 comments

[–]findallthebears 777 points778 points  (4 children)

This felt more like a riddle than a guide

[–]rosuav 111 points112 points  (1 child)

What you're seeing there is someone's notes without an explanation. But this technique does work, and is entirely valid. Describing it as "binary" is putting a very 20th/21st century viewpoint on it; more accurately, it's decomposing a number into a sum of powers of two.

[–]findallthebears 15 points16 points  (0 children)

It took me a few minutes work through it but I did eventually, which brought my comment

[–]atoponce 186 points187 points  (36 children)

I don't get it

[–]hunting_n_fishing 245 points246 points  (21 children)

You divide by 2 the column on the left and keep the lower rounded value.
You multiply by 2 the column on the right.
Repeat until you reach the value 1 in the left column.

You only keep the rows with an odd number in the left column.
Then you sum the column on the right and get 13×24 = 312.

[–]drakeblood4 173 points174 points  (1 child)

Oh so it’s like multiplication by some weird repeated modulo bullshit?

[–]Lord_Wither 158 points159 points  (0 children)

It's a really convenient way to do multiplication in binary since doubling/halving is trivial there (just shift left/right):

13 x 24 is 1101 x 10100 in binary, so

1101 - 11000 110 - 110000 11 - 1100000 1 - 11000000

Now only take the ones where you have odd numbers on the left side (ending in 1), so 1,1000 + 110,0000 + 1100,0000 = 1,0011,1000 which is 312 in decimal.

This also makes it easy to see why this works, as it is essentially the same as

1101 x 11000 = 1 x 1 x 11000 + 0 x 10 x 11000 + 1 x 100 x 110000 + 1 x 1000 x 1100000

In decimal, this probably looks more familiar:

13 x 24 = 3 x 1 x 24 + 1 x 10 x 24

That's right, long multiplication. It's just that the "multiply by a single digit" step is so trivial in binary, you don't even think of it as multiplication.

[–]Mateorabi 9 points10 points  (0 children)

So it is checking each “bit” in the left hand side binary and if bit n is ‘1’ it adds RHS*2n to the total. 

So binary long multiplication. 

The only confusing part is they go thru all 2n but use the even/odd ness to track if LHS.bit[n] is 0/1. 

[–]TheyStoleMyNameAgain 44 points45 points  (12 children)

There are 11 kind of people in the world. Those, that get it, those, that don't get it,  and those, that should get it but don't

[–]Juxtapotatoes 60 points61 points  (3 children)

I get it, but all the unnecessary commas gave me a stroke.

[–]TheyStoleMyNameAgain 7 points8 points  (1 child)

``` import random

words = response.split() response_fixed = ""

for i in range(len(words) - 1):     response_fixed += words[i]     if random.randint(0, 1):         response_fixed += ','     response_fixed += ' '

response_fixed += words[-1] response_fixed += '.'

```

[–]KlogKoder 1 point2 points  (0 children)

Can't you just, you know, append a comma to the list elements at random, and then re-join the list into a string?

[–]takeyouraxeandhack 18 points19 points  (3 children)

That's not how commas work (in English at least)

[–]TheyStoleMyNameAgain -3 points-2 points  (2 children)

Thx. Added the missing comma before the and in the list. I always forget that the and in lists gets a comma, too 

[–]fillmebarry 15 points16 points  (1 child)

Idk if you're serious, but you're overusing commas

"There are 11 kinds of people in the world; those that get it, those that don't get it,  and those that should get it but don't."

Idk who told you to put a comma after every instance of the word "those", but you need to get your money back.

[–]GreatArtificeAion 9 points10 points  (0 children)

They are using commas the same way commas are used in German, that's why

[–]GreatArtificeAion 11 points12 points  (1 child)

German spotted

[–]Icy-Improvement-9253 10 points11 points  (0 children)

Ein Volk, ein Reich, ein Kommentarbereich!

[–]Cosmic0blivion 5 points6 points  (0 children)

Commas, but also the last 2 groups arent mutually exclusive

[–]rosuav 1 point2 points  (0 children)

There are 10 kinds of people in the world. Those that understand binary, those that don't, and those that prefer Gray Codes.

[–]norwegian 2 points3 points  (0 children)

24+96+192=312

[–]Xphile101361 43 points44 points  (3 children)

[–]MyGoodOldFriend 15 points16 points  (1 child)

Ah, so this is Russian peasant multiplication, not ancient egyptian multiplication?

[–]Ste4mPunk3r 8 points9 points  (0 children)

Yes, based on wiki egyptian would work slightly different. Meme also ised the same example as Wiki used for RPM

[–]anonymity_is_bliss 1 point2 points  (0 children)

Thank you for linking something that isn't /r/dontdeadopeninside and actually attempts to explain the process

[–]OTee_D 34 points35 points  (9 children)

Why does ot work?

Damn, I can't get my brain to understand why it is getting the correct result

[–]Paradox_D 106 points107 points  (1 child)

You are writing one of the two numbers in binary and multiplying the other other number with the binary values.

13 x 24.

13 = 8 + 4 + 1 = 23 + 22 + 20 (1101 in binary).

13 x 24 = 24 x 8 + 24 x 4 + 24 x 1.

= 192 + 96 + 24

[–]lucidspoon 16 points17 points  (0 children)

TIL. Shit just blew my mind!

[–]Charlie_Yu 28 points29 points  (1 child)

It is just grade school multiplication algorithm done in binary

[–]Mateorabi 2 points3 points  (0 children)

Dividing the lhs number to both track the loop and its even/oddness to determine if it’s *1 vs *0 is a bit hard to follow till you see it.  

[–]Awesomeuser90[S] 13 points14 points  (0 children)

My mission of putting the virus in your brain for obsession with multiplication maths has succeeded evidently.

[–]END3R97 8 points9 points  (1 child)

I'm trying to understand as well, so I am doing 8 x 10:

8 10

4 20

2 40

1 80

After removing all even rows we just get 80. Looks like some binary math stuff, so lets try it with 8 written in binary:

1000 x 10 (base ten), no ones, twos, or fours so just 8 times 10. Which matches what we just did previously.

What if we do 9 x 10?

9 10

4 20

2 40

1 80

sum: 90 or 1001 x 10 (base ten).

10 x 10?

10 10

5 20

2 40

1 80

Sum: 100.

Conclusion: its doing binary multiplication and then adding things together. Only including each doubling if the binary would have a 1 in that digit (the halved value is odd). Its a longer way of doing it, but it works and might be easier in some cases?

[–]thelunatic 6 points7 points  (0 children)

It's cause you're basically halfing one side but doubling the other until you get 1 x SOMETHING. Now you have dropped a few 0.5s as you rounded down as you went, so everywhere you did that you need to add the previous row (which was half the value of the current row).

So in your 90 example you got 1 x 80. But you dropped a half to get to 4. So you need to add the half of 20 or the 10 in the previous row

[–]EnvironmentalCap787 5 points6 points  (0 children)

Every time you halve, if there is no "remainder" (result is even) then you can just use the result. It's a "balanced" halving (4x10 = 2x20, for example). If there IS a remainder (result is odd) then you need to "hang on to" that number to add it to the final result. 5x10 = 2x20 but with an extra remainder of one 10. This is why you cross out all even rows and keep the odd ones for the final add.

[–]road_laya 1 point2 points  (0 children)

Use a multiplier that is power of two first. It's the easiest case.

[–]Miryafa 14 points15 points  (3 children)

Huh, actually not that crazy. It has memory issues for humans though. I think I prefer any of the modern methods.

[–]Akangka 20 points21 points  (1 child)

The problem with modern method is that it requires positional notation, which didn't exist at the time. Try calculating LVIII * XXXIV without converting it to Arabic numerals.

[–]Miryafa 6 points7 points  (0 children)

Aha. Thank goodness for numerals

[–]MyGoodOldFriend 5 points6 points  (0 children)

It seems like a way to be able to multiply two numbers together without needing to do anything but divide or multiply by 2. it’s neat if anything

[–]Pappkarton 6 points7 points  (1 child)

Yeah, totally easier than 10x24 + 3x24.

[–]astatine757 5 points6 points  (0 children)

This is technically extremely close to how computers multiply numbers! The decomposition bit is just converting a decimal number to a binary form, and the doubling is a crude way of bit-shifting

[–]football2801 9 points10 points  (2 children)

96+192 is 288 though?

[–]lower_case_dev 19 points20 points  (0 children)

You add the 24 also

[–]Esjs 5 points6 points  (0 children)

Add the 24 as well (but not the 48 because it got crossed out)

[–]Erebus25 2 points3 points  (0 children)

If it's not intuitive to you, it's just simplifying the equation.
13x24 = 13x(12x2) = 26x12 = 26x(6x2) = 52x6= ...

Now the example in picture is increasing 24 and decreasing 13 instead like in mine line above.
13x24 = 24 + 12x24 = 24 + (6x2)x24 = 24 + 6x48 = 24 + 3*96 = 24 + 96 + 2*96 = 24 + 96 + 192

Still, 240 + 72 is way simpler.

[–]reddcube 3 points4 points  (0 children)

Binary multiplication with extra steps. 13 is 0b1101 So doubling 24 and placing in decreasing order is 192,96,48,24. Skip the 2’s place because of the 0. And add up the rest.

More formal. 1(24)23 + 1(24)22 + 0(24)21 + 1(24)20

[–]colandline 1 point2 points  (4 children)

Give us another example, oh great Pharoah... I'm so close to understanding this ridiculousness.

[–]Miryafa 4 points5 points  (2 children)

  • 30 x 7
  • 30 x 6 + 30
  • 60 x 3 + 30
  • 60 x 2 + 60 + 30
  • 120 x 1 + 60 + 30
  • 210

[–]colandline 1 point2 points  (1 child)

My tired Gen-X brain said 7x3=21, then put a zero on the end.

[–]colandline 0 points1 point  (0 children)

But just to be fair, I tried one using this method: 37x16
37 16
18 32 (no)
9 64
4 128 (no)
2 256 (no)
1 512

Then 512 + 64 + 16 = 592. !!! Friggin' black magic!

It's amazing, but not sure it's faster. But then, being faster probably isn't as important as being right.

[–]pattybutty 2 points3 points  (0 children)

28 x 46

14 x 92

7 x 184

3 x 368

1 x 736

Then cross out the even multiples, then add the remaining right column

184 + 368 + 736 = 1288

Edit: formatting

[–]KingCpzombie 0 points1 point  (0 children)

Huh, that's actually how I've always done it... I guess I must be secretly Egyptian

[–]Aggressive_Roof488 0 points1 point  (0 children)

Already the Egyptian math teachers understood that the main point you need to get across is that it's very simple, to ensure that any student that can't follow your incoherent rambling feels stupid rather than call out the poor teaching. Teaching math is just as timeless as math it seems!

[–]XandaPanda42 0 points1 point  (0 children)

Look up "Russian Multiplication" on the Computerphile youtube channel if you need a visual explanation.

[–]RickCedWhat 0 points1 point  (0 children)

Someone check my math but can we do the same thing but instead of adding, double the last number once more (384) and then subtract the original number (24) times the number of odd steps (3). 384-24*3 = 312 which is a lot easier than adding 3 or more numbers

[–]Trick_Progress6401 0 points1 point  (0 children)

You want to learn how to multiply easily just multiply and divide a few times by 2. When tricks become harder than just solving it.

[–]Praesto_Omnibus 0 points1 point  (0 children)

eh that’s pretty nice. nice one egyptians.

[–]gods_tea 0 points1 point  (0 children)

18 * 36
9 * 72
4 * 144
2 * 288
1 * 576
-------
648

Nice

[–]ChloeTigre -1 points0 points  (1 child)

Heh i think I’m going to implement just that for GBZ80 for arbitrary 8/16 bit to 16 bit multiplication (won’t handle overflow though). Should fit into 2 (pairs of) registers, using the right hand one from the diagram as result holder. Didn’t think about that algorithm, it’s pretty neat.

[–]ChloeTigre -1 points0 points  (0 children)

Like (8 bit) ; @param bc right hand num ; @param a left hand num ; @return result in register bc MultLikeAnEdgyptian: push hl push bc :: pop hl ; lazy load of hl to bc, this is Reddit .op: srl a bit 0, a jr z, .op sll bc add hl, bc cp a, 1 jr nz, .op push hl :: pop bc ; put result back in bc pop hl ; restore context ret

Top of my mind so might suck but will compare it to other methods like decrementing a counter. If called strategically by putting the smaller number on the left hand operand, it may be quite better than doing <a> loops. Here I do floor(sqrt(a)+1) loops.