• s=3 y=y
2=3442
2 (mod 4033)=2443(mod 4033)
• s=4 y=y
2=2443
2 (mod 4033)=3442(mod 4033)
• s=5 y=y
2=3442
2 (mod 4033)=2443(mod 4033)
• Demak, berilgan son murakkab.
Ko'paytirish vaqtini logaritmik deb hisoblasak, tezkor modulli ko'paytma yordamida
algoritmning murakkabligi O (klog3 n), bu erda k turlar soni ...
Shunday qilib, algoritmning ishlash vaqti polinom hisoblanadi. Biroq, FFT yordamida algoritmning ishlash vaqtini O(klog2 (n)log (log (n))log (log (log (n)))) ga qisqartirish
mumkin. Bunday holda, biz k = log2(n) ni olsak, bu yerda n - tekshirilishi kerak bo'lgan
raqam, u holda algoritmning murakkabligi O(log3n) ga teng.
Rabin-Millerning sonlarni
tublikka tekshirish algoritmini dasturiy moduli
public static
boolean isPrimeAccordingToMillerRabin(int number, int roundCount){
int numberMinus1 = number - 1;
int t = numberMinus1;
int s = 0;
while (t % 2 == 0)
{ t /= 2; s++; }
for (int i = 0; i < roundCount; i++)
{ int randomInt = randomIntInRange(2, number - 2);
int x = pow(randomInt, t, number);
if (x == 1 || x == numberMinus1) continue;
boolean flagToStop =
true;
for (int j = 0; j < s - 1; j++)
{ >x = pow(x, 2, number);
if (x == 1){ return
false;
}
if (x == numberMinus1)
{ flagToStop =
false;