Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Multiplication is a way to do adding faster, and division is a way to do subtraction faster.

Can you elaborate? If you need to do 13 + 13 + 13 + 13, you can do that as 13 x 4, which I guess is what you mean by the first part; but what analagous subtraction could you replace with a division?



Not OP, but I'm guessing he means this:

52/13:

52 - 13 = 39

39 - 13 = 26

26 - 13 = 13

13 - 13 = 0

count the subtractions and you get 4.

As long as we're sticking to integer division, this works out fairly well. Here, a calculation with a remainder:

54/13:

54 - 13 = 41

41 - 13 = 28

28 - 13 = 15

15 - 13 = 2 (smaller than 13, so this is our remainder)

54/13 = 4 with 2 reaminder




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: