Sir int he start you wrote if(a^d%n==1) , then n can be prime,
and then you said for every x ,x belongs to a^(dpow(2,i)) i goes from 0 to s-1, if (x%n==1 || x%n==n-1) then n is prime , BUT int the END you wrote only two conditions a^d%n==1 or a^(dpow(2,i)) %n =n-1, shouldn’t there be a third condition that a^(d,pow(2,i))==1, where i goes from 0 to s-1.
One condition is missing
Hello @ash_sinha,
No, it i.e. a^(d,pow(2,i))==1 shouldn’t be the third condition.
The two mentioned conditions are sufficient.
BTW, sir has given no explanation for this a^(d,pow(2,i))==1 condition in the video.
Sir at 14:57 in the video it is written x%n=1 where x is of the form a^(d*pow(2,i)) i goes from 0 to s-1. I am referiing here that sir wrote this condition but in the END he missed this condition
No @ash_sinha,
that might be a mistake.
You have only check for the two conditions mentioned in the code.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.