Guest User

Untitled

a guest
Apr 3rd, 2016
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. //Euler problem #3
  3. int main(){
  4. long long i, sqi;
  5. long long value, large = 600851475143LL;
  6. long long max = 0LL;
  7.  
  8. i = 2LL;
  9. sqi = 4LL; //i*i
  10. for(value = large; sqi <= value ; sqi += 2LL * i++ + 1LL){
  11. while(value % i == 0LL){
  12. value /= (max=i);
  13. }
  14. }
  15.  
  16. if(value != 1LL && value != large){
  17. max = value;
  18. }
  19. if(max == 0LL){
  20. max = large;
  21. }
  22. printf("%lld\n", max);
  23. return 0;
  24. }
RAW Paste Data