Another attempt. Uses sieving. Still not correct answer although super fast.