for(i=0; i<n+1; i++)
{
y=y+(a[i]*(int)Math.pow(j,i));
}
int r=y/786433;
s[k]=y-(r*786433);
k++;
Now in this code the j
value can be 786432
. So when I try to get modulus of a number say (1+2*(786432)^2+3*(786432)^3)%786433
then I get -521562
which is not correct I was using modulus operator before too but I got the same answer even with this approach I am getting the same answer. In this approach the modulus of the number is stored in array s[k]
. Can anyone help?