Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)
Paste
Pasted as C++ by s.r ( 16 years ago )
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main() {
unsigned long n,i,j,tof,ii;
bool test;
vector<unsigned long> a;
cin >> n;
a.resize(n);
a[0] = 2;
ii = 1;
for(i = 3; ii < n; i+=2) {
tof = sqrt(i);
test = true;
for(j = 0; a[j] <= tof; j++)
if (i % a[j] == 0)
test = false;
if (test) {
a[ii] = i;
ii++;
}
}
cout << a[a.size() - 1] << endl;
}
Revise this Paste
Parent: 22263
Children: 22265