Algorithm 素性检验的朴素蒙特卡罗算法的成功概率

Algorithm 素性检验的朴素蒙特卡罗算法的成功概率,algorithm,probability,montecarlo,number-theory,Algorithm,Probability,Montecarlo,Number Theory,考虑下面的朴素蒙特卡罗算法n,用于测试数字n的素性 isPrimeMonteCarlo(n,t){ /* * Take an integer n as input and check wheather it is prime or not * using the naive monte carlo method. * If the number is prime return True else return False. * */ if(n<=1) return Fals

考虑下面的朴素蒙特卡罗算法n,用于测试数字n的素性

isPrimeMonteCarlo(n,t){
/*
 * Take an integer n as input and check wheather it is prime or not
 * using the naive monte carlo method.
 * If the number is prime return True else return False.
 * */
if(n<=1)
    return False
m = sqrt(n);
for i = 1 to t:
    j = random()%m+2
    if n%j==0:
        return False
return True
}
isPrimeMonteCarlo(n,t){
/*
*取整数n作为输入,检查它是否为素数
*使用朴素的蒙特卡罗方法。
*如果数字为prime,则返回True,否则返回False。
* */

如果(N)请使用拼写检查器;也请更正标题。在没有代码的数学论坛上,你似乎要问的问题可能会更好。我试着四处看看,但这不是同一个问题;ITIRC有其他边界,N的一半除数应