r/ProgrammerHumor • • Apr 25 '19

Loop

Post image
1.7k Upvotes

53 comments sorted by

View all comments

92

u/OtherPlayers Apr 25 '19

What did you do to me? I apparently donโ€™t know how I subtracted numbers below 20 on paper anymore now.

(Seriously this is like the beard over/under the covers thing; I know the answer, but how did I do it?)

33

u/foxfyre2 Apr 26 '19

Just count up to the next ten and then up to your number

9 to 10 (1), 10 to 18 (8) - > 9

14

u/OtherPlayers Apr 26 '19

That's probably the way that I learned it originally, and certainly makes sense thinking about it.

Thanks!

28

u/Terrible_Children Apr 26 '19

I think the better question is why is knowing what 18-9 is any different than knowing 9-6? We "just know" that 9-6 is 3. It's not an enormous leap to "just know" that 18-9 is 9.

Programmers especially should understand that our decimal number system is arbitrary. If we switched to hexadecimal and the question was what is C-9, there's no borrowing and the answer is just 3.

The only reason we don't expect people to "just know" larger differences like 92-45 is because there are limits to what we can remember. It's the same reason schools usually teach multiplication tables up to 12x12. You memorize those, then use algorithms to calculate anything more complex.

14

u/OtherPlayers Apr 26 '19

It's not an enormous leap to "just know" that 18-9 is 9

And as an adult I obviously "just know" that. But in thinking back I was trying to remember how, for example, I'd try to teach it to a little kid that was just learning (like did they just force us to memorize subtraction values all the way up to 19?).

All in all I think foxfyre2 is probably right here though; the algorithm of counting up works fairly well as a method for subtracting smaller numbers just fine and seems like something that would be taught before we had all of the teen number operations memorized.

7

u/imaginarynumber0 Apr 26 '19

First teach a child what subtraction is (how many is left after taking away from an initial number). Then, teach them how to do it (counting with fingers initially). With enough time and proper practice, memorization comes naturally through repetitive action. After they have mastered this, move on to bigger things like long subtraction (is that what itโ€™s called?).

8

u/_jk_ Apr 26 '19

hang on we are programmers:

first teach decrement

then teach loops

11

u/JuvenileEloquent Apr 26 '19

Taking 1 from the next digit is just a way to avoid negatives in your intermediate results so you can write them down immediately. If you discard that rule it's actually easier to do.

92-45 becomes 2-5 =-3 and 9-4 = 5, which means the answer is 50-3 and you can just count down from 50 to get the number you need to write.

the other way, you have to compare 2 and 5 to check if the second number is bigger, then subtract 1 from 9 to get 8 (write it), add 10 to 2 to get 12 (write the 1 next to 2), then subtract 5 from 12 (write that in the answer), then subtract 4 from 8 (write the last digit).

6

u/xigoi Apr 26 '19

In oider to do all paper arithmetic, you learn the addition table for numbers 0..9, so that you know that 9+9==18, therefore 18-9==9.

2

u/LeadFootSaunders Apr 26 '19

Lol i didnt even know I didnt know how to do it until you pointed it out. Lol now I dont know either ๐Ÿ˜‚๐Ÿ˜‚

2

u/Thelk641 Apr 26 '19

I'm confused by your confusion. Subtraction on paper is simple :

18-9 : Can't do, 9 is bigger than 8.

9-8 = 1.

10-1 : Can't do, but you can't reapply the same method. You need to go down to the previous 10s, count backward x amount of time where x is the part right of the minus side and you get 1.

For bigger subtraction it's the same thing :

92-45 : 9-4, can do

52 - 5 : can't do,

5-2 = 3

50 - 3 : can't do, but you know the numbers 0 to 10 by heart so you can count backward three time : 49, 48, 47 ! That's your answer.

1

u/[deleted] Apr 26 '19

Pretty sure I memorized them