Added a recursive solution to P31.
Added non-recursive solution to P31