library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub shibh308/library

:warning: lib/functions/eratisthenes.cpp

Code

auto eratosthenes = []{
	constexpr int N = 2e6;
	bitset<N> not_prime(3);
	for(int i = 2; i < N; ++i)
		if(!not_prime[i])
			for(int j = 2 * i; j < N; j += i)
				not_prime.set(j);
	return not_prime;
};
#line 1 "lib/functions/eratisthenes.cpp"
auto eratosthenes = []{
	constexpr int N = 2e6;
	bitset<N> not_prime(3);
	for(int i = 2; i < N; ++i)
		if(!not_prime[i])
			for(int j = 2 * i; j < N; j += i)
				not_prime.set(j);
	return not_prime;
};
Back to top page