Pagini recente » Cod sursa (job #606604) | Cod sursa (job #69722) | Cod sursa (job #2118008) | Cod sursa (job #2725905) | Cod sursa (job #2253616)
#include <fstream>
#include <string>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
int totneg=0;
bool v[1000000];
int n;
void ciur(){
for(int i=2; i<=n; i++){
int tour=0;
if(!v[i]){
for(int j=i+i; j<=n; j+=i){
v[j]=true;
tour++;
totneg+=tour*2;
}
}
}
}
int main()
{
in>>n;
int tot=n*n;
ciur();
totneg+=n-1;
out<<tot-totneg;
}