We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
algocpp::math::isprime
Function for fast determination of prime numbers
This program is by @asksaito of Qiita. Thank you!
$O(1)$ if $N$ is even or less than $2$
Otherwise, $O(\sqrt N)$
#include <iostream> #include <algocpp/math.hpp> using namespace std; int main() { cout << boolalpha; // false cout << algocpp::math::isprime(15) << endl; // true cout << algocpp::math::isprime(17) << endl; }