You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include <stdio.h>
static const unsigned int prime = 19448089;
unsigned int permuteQPR(unsigned int x)
{
if (x >= prime)
return x; // The 5 integers out of range are mapped to themselves.
unsigned int residue = ((unsigned long long) x * x) % prime;
return (x <= prime / 2) ? residue : prime - residue;
}
#define CALC(x) { \
printf("value: %u permute: %u\n",x,permuteQPR(x)); \
}while(0)
void main(void) {
CALC(0);
CALC(3721041);
CALC(15256836);
CALC(prime);
CALC(0xFFFFFFFF);
}