#2 was fun, got to use loop and took advantage of tail-recursion elimination, I think