我不断收到错误“不能在 math.Pow 的参数中使用 (type int) 作为 float64 类型,不能在 math.Pow 的参数中使用 x (type int) 作为 float64 类型,无效操作:math.Pow(a, x ) % n (float64 和 int 类型不匹配) "
func pPrime(n int) bool {
var nm1 int = n - 1
var x int = nm1/2
a := 1;
for a < n {
if (math.Pow(a, x)) % n == nm1 {
return true
}
}
return false
}
Run Code Online (Sandbox Code Playgroud)