fork(4) download
  1. #include<bits/stdc++.h>
  2. #include <boost/multiprecision/cpp_int.hpp>
  3. using boost::multiprecision::cpp_int;
  4. using namespace std;
  5.  
  6. int32_t main() {
  7. int start = clock();
  8. int p = 8624;
  9. cpp_int M;
  10. bit_set(M, p);
  11. M = M-1; // M = 2^p - 1;
  12. cpp_int S;
  13. S = 4;
  14. while(p>2) {
  15. S = pow(S, 2);
  16. S -= 2;
  17.  
  18. S %= M;
  19. p--;
  20. }
  21. // cout << S << endl;
  22. int end = clock();
  23. cout << "time: " << (end - start)/(double)(CLOCKS_PER_SEC)*1000 << " milliseconds\n";
  24.  
  25. }
Success #stdin #stdout 1.93s 15288KB
stdin
Standard input is empty
stdout
time: 1933.19 milliseconds