Brute force method for prime generator