I want to view all solution for: X^12≡1(mod27) So I wrote the following C++ program which outputs only 1 even though 8 and 10 are possible values for x too.
Why is that?
#include <iostream>
#include <cmath>
int main() {
for (int i = 0; i <= 2700000; ++i) {
if (int(pow(i, 12))% 27 == 1) {
std::cout << i << std::endl;
}
}
std::cout << "Hello, World!" << std::endl;
return 0;
}