fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long input = 600851475143;
  6. long long mx = 0;
  7. for (int x = 2; x <= input/x; ++x){
  8. while(input%x==0) {input/=x; mx = x; }
  9.  
  10. }
  11. if (input > 1){
  12. mx = input;
  13. }
  14. cout << mx << endl;
  15. return 0;
  16. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
6857