diff --git a/number_theory/counting_primes/gen/boundaryA.cpp b/number_theory/counting_primes/gen/boundaryA.cpp new file mode 100644 index 000000000..ff725dedb --- /dev/null +++ b/number_theory/counting_primes/gen/boundaryA.cpp @@ -0,0 +1,25 @@ +#include +#include +#include + +#include "../params.h" +#include "random.h" + +using namespace std; +using ll = long long; + +ll f(ll n) { + ll ret = 1; + while ((ret + 1) * (ret + 1) <= n) ++ret; + return ret * ret; +} + +int main(int, char* argv[]) { + long long seed = atoll(argv[1]); + auto gen = Random(seed); + + ll N = gen.uniform(1000LL, N_MAX - 10L); + ll d = seed % 3 - 1; + printf("%lld\n", f(N) + d); + return 0; +} diff --git a/number_theory/counting_primes/gen/boundaryB.cpp b/number_theory/counting_primes/gen/boundaryB.cpp new file mode 100644 index 000000000..b1fb71b84 --- /dev/null +++ b/number_theory/counting_primes/gen/boundaryB.cpp @@ -0,0 +1,25 @@ +#include +#include +#include + +#include "../params.h" +#include "random.h" + +using namespace std; +using ll = long long; + +ll f(ll n) { + ll ret = 1; + while ((ret + 1) * (ret + 2) <= n) ++ret; + return ret * (ret + 1); +} + +int main(int, char* argv[]) { + long long seed = atoll(argv[1]); + auto gen = Random(seed); + + ll N = gen.uniform(1000LL, N_MAX - 10L); + ll d = seed % 3 - 1; + printf("%lld\n", f(N) + d); + return 0; +} diff --git a/number_theory/counting_primes/hash.json b/number_theory/counting_primes/hash.json index e40d89b19..fb12aecd9 100644 --- a/number_theory/counting_primes/hash.json +++ b/number_theory/counting_primes/hash.json @@ -1,6 +1,18 @@ { "Grothendieck_prime_00.in": "1326faec3eb42dc72ddffe46daf3940b932f48b9799f6cbf28e80504e7b34958", "Grothendieck_prime_00.out": "e6c21e8d260fe71882debdb339d2402a2ca7648529bc2303f48649bce0380017", + "boundaryA_00.in": "b44391656257f26c801f98ac51881f8c74b0257c45c8eb71206714124ce54ec0", + "boundaryA_00.out": "bfa906b59b2adadecfb4a8f579ee5764c95d3fcc88461c95e4a33ae16e9b36e8", + "boundaryA_01.in": "6c1dda55aa851edc4d63c08655f79e9c16322d97638353359110c2db8fa6eca0", + "boundaryA_01.out": "c5d8d26963b27aa96afe57b0f45df25a4046c547cd62e8386494a76b278a3387", + "boundaryA_02.in": "a17d41183e3112b174418b9d92dce5552eb06151020751772dd9ef375d023156", + "boundaryA_02.out": "c1dab05b2d523d5b3cba478b568ed341243604ffcd172f6805498beaaae08874", + "boundaryB_00.in": "4fe3abc1bea17df8c4a5bc8e3b4b80060c25ada78fc9fd841f85e0be0cf86188", + "boundaryB_00.out": "3db2711518666d7912e03f091025454fe4ab5ec59472fde697aa4a281395fe1e", + "boundaryB_01.in": "45ac66b6c92efcf6cff04b0a4a6be711efff0b82da8933b7e7ff7569f6e0716e", + "boundaryB_01.out": "38e776345928ed1af8c6f8821d094c955bf392cbec6e03811081841028682e30", + "boundaryB_02.in": "e4613952027e08848794184d617814ad4efc765836d4239391cc552bf24e08d7", + "boundaryB_02.out": "1e19bfee04bf045df32cb6e22a17093998cb6424d64ef79dac7f676acbc87a9f", "example_00.in": "917df3320d778ddbaa5c5c7742bc4046bf803c36ed2b050f30844ed206783469", "example_00.out": "7de1555df0c2700329e815b93b32c571c3ea54dc967b89e81ab73b9972b72d1d", "example_01.in": "eea8254c7500ba3de996aa8ad6af399183f04e17d4a8102fde539dbc93a90012", diff --git a/number_theory/counting_primes/info.toml b/number_theory/counting_primes/info.toml index 3b7ad1510..bf65a1fa2 100644 --- a/number_theory/counting_primes/info.toml +++ b/number_theory/counting_primes/info.toml @@ -23,6 +23,12 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/388" [[tests]] name = "small_prime.in" number = 2 +[[tests]] + name = "boundaryA.cpp" + number = 3 +[[tests]] + name = "boundaryB.cpp" + number = 3 [params] N_MAX = 100_000_000_000