Today in math, we learned about a method of multiplication called Peasant Multiplication that works for positive whole numbers, and is pretty cool. Here's a rundown on how it works, although it's kind of hard to understand and I'm not sure how well the website explains it.
I implemented this in ruby!
View it in action here by pressing the run button
The full code I wrote is here, which is extensible in case I get around to testing the efficiency of this algorithm compared to other methods.
No comments:
Post a Comment