solve Problem#10 by BF. isPrime use sqrt