Pagini recente » Profil teodoraloredana | Cod sursa (job #709332) | Cod sursa (job #1507704) | Cod sursa (job #1572199) | Cod sursa (job #2698261)
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin ("fractii.in");
ofstream fout ("fractii.out");
const int MAX = 10000;
main ()
{
int N, s = 0, vector[MAX], sol = 0;
fin >> N;
for (int c = 2; c <= N; c++)
vector[c] = c - 1;
for(int c = 2; c <= N; c++){
sol = sol + vector[c];
for (int j = 2 * c; j <= N; j += c)
vector[j] -= vector[c];}
fout<<2* sol +1;
return 0;
}