fork download
  1. #include <stdio.h>
  2.  
  3. /* 01234567890123456 */
  4. #define L 1000000000000001
  5. #define M 9999999999999997
  6.  
  7. void f(long long n, int delta) {
  8. unsigned long long m, q, r;
  9. for (;; n += delta) {
  10. m = 1;
  11. do {
  12. m += 2;
  13. q = n / m;
  14. r = n % m;
  15. } while (r != 0 && q >= m);
  16. if (r == 0) {
  17. /* printf("\n%llu(%llu * %llu...%llu)", n, m, q, r); */
  18. continue;
  19. }
  20. if (q < m) {
  21. printf("\n%llu\n", n);
  22. break;
  23. }
  24. }
  25. }
  26.  
  27. void step1(void) { f(L, +2); }
  28. void step2(void) { f(M, -2); }
  29.  
  30. int main() {
  31. step1();
  32. step2();
  33. return 0;
  34. }
  35. /* end */
  36. /*
  37.  
  38. */
  39.  
Success #stdin #stdout 6.63s 1832KB
stdin
Standard input is empty
stdout
1000000000000037

9999999999999937