Pagini recente » Cod sursa (job #2208392) | Cod sursa (job #956848) | Cod sursa (job #1625725) | Cod sursa (job #1953766) | Cod sursa (job #1338864)
#include <cstdio>
#include <algorithm>
using namespace std;
FILE *fin=freopen("mins.in","r",stdin);
FILE *fout=freopen("mins.out","w",stdout);
int c, d;
int PHI[1000013];
long long int cnt = 1;
int main()
{
scanf("%d %d", &d, &c);
if(d < c)
swap(c, d);
--c, --d;
PHI[1] = 1;
for(int i = 2; i <= d; ++i)
PHI[i] = i - 1;
for(int i = 2; i <= c ; ++i)
for(int j = 2 * i; j <= d; j += i)
--PHI[j];
for(int i = 2; i <= d; ++i)
{
//printf("%d ", PHI[i]);
if( i <= c )
cnt += 1LL * 2 * PHI[i];
else
cnt += 1LL * PHI[i];
}
printf("%lld", cnt);
}