# The Importance of good algorithm design

Working through the 99 Lisp Problems in Erlang and just did a comparison of two different methods for computing Euler's totient function. The results:

> lp:p39(10090). p34 took 10864 micro seconds and returned 4032. p37 took 72 micro seconds and returned 4032.

I'll leave it to the reader to work the problems themselves, but it does illustrate the importance of good algorithm design in mission-critical parts of your code. Were my application's lifeblood to be in calculating phi, and I was naive and took the p34 algorithm to solve for phi, I would be 150x slower at doing the job. I guess the moral is, always research mission-critical portions of code for optimized algorithms. A sub-moral would be to keep abreast of the latest and greatest in algorithms and math in general. I like to have a friend in grad school studying quantum mechanics to keep me informed!