Added smarter, recursive ugly numbers approach