For some reason when dealing with large numbers, the modulus operator doesnt give me the correct output, have a look at the code
double x = Math.pow(65,17) % 323
You can use int like this
int n = 65; for (int i = 1; i < 17; i++) n = n * 65 % 3233; System.out.println(n);
or BigInteger like
System.out.println(BigInteger.valueOf(65).pow(17).mod(BigInteger.valueOf(3233)));
both print
2790