x.cpp 958 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // a(n) is the least integer k such that the remainder of k modulo p is strictly increasing over the first n primes.
  2. // https://oeis.org/A306582
  3. // a(16) = 483815692
  4. // a(17) = 483815692
  5. // a(18) = 5037219688
  6. // a(19) = 18517814158
  7. // a(20) = 18517814158
  8. #include <set>
  9. #include <iostream>
  10. #include <vector>
  11. #include <algorithm>
  12. using namespace std;
  13. int main() {
  14. long long int p = 73;
  15. long long int primes[20] = { 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2 };
  16. for (long long int k = 18517814158LL; ; ++k) {
  17. //cout << k << endl;
  18. auto max = k % p;
  19. bool ok = true;
  20. for (auto q : primes) {
  21. if (k % q < max) {
  22. max = k % q;
  23. }
  24. else {
  25. ok = false;
  26. break;
  27. }
  28. }
  29. if (ok) {
  30. cout << "Found\n";
  31. cout << k << "\n";
  32. break;
  33. }
  34. }
  35. }