Added lg() algorithm in Exercise 14