Naive method improved, can check for all numbers, a little bit faster