fork(2) download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. long long divd(long long N, long long start)
  6. {
  7. for(long long i = start; i*i <= N; i+=2)
  8. {
  9. if (N%i == 0) return i;
  10. }
  11. return N;
  12. }
  13.  
  14.  
  15. int main()
  16. {
  17. long long N = 600851475143ll;
  18. long long start = 3;
  19.  
  20. while(N%2 == 0)
  21. {
  22. puts("2");
  23. N /= 2;
  24. }
  25.  
  26. while(N > 1)
  27. {
  28. start = divd(N,start);
  29. N /= start;
  30. printf("%lld\n",start);
  31. }
  32. }
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
71
839
1471
6857