Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- typedef unsigned int uInt;
- using namespace std;
- int main()
- {
- bool is_prime;
- uInt count = 1;
- uInt my_prime = 2; //первое простое
- for(uInt i = 3; count < 10001; i += 2) { //пропускаем все четные, находим 10001е простое
- is_prime = true;
- for(uInt j = 3; j * j <= i && is_prime; j += 2) //пропускаем четные
- if(i % j == 0) is_prime = false;
- if(is_prime) {
- ++count;
- my_prime = i;
- }
- }
- cout << my_prime;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement