blob: 415867763f359802644766f240df503b83419b21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <iostream>
#include <cmath>
bool isPrime( int number ) {
int stop = std::sqrt( static_cast<double>( number ) ) ;
for ( int i = 2 ; i <= stop ; ++i )
if ( number % i == 0 )
return false ;
return true ;
}
int main( ) {
int current = 1 ;
int numberOfPrimes = 0 ;
while ( numberOfPrimes != 10001 ) {
current++ ;
if ( isPrime( current ) ) {
numberOfPrimes++ ;
}
}
std::cout << current << std::endl ;
return 0 ;
}
|