-
Notifications
You must be signed in to change notification settings - Fork 0
/
DIV.cpp
69 lines (69 loc) · 1.4 KB
/
DIV.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
std::vector<bool>b(1000001,true);
long int a[500001];
void Calcprimes()
{
long int i,j,k;
b[1]=false;
k=1;
a[0]=2;
for (i=3;i<=1000;i+=2)
{
if (b[i]==true)
{
for (j=i*i;j<=1000000;j+=2*i)
b[j]=false;
}
}
for (j=3;j<=1000000;j+=2)
if (b[j]==true)
a[k++]=j;
}
int main()
{
long int i,j,n,count1,ans,d,count2=0;
Calcprimes();
for (i=3;i<=1000000;i++)
{
if (b[i]==true && i%2!=0)
continue;
n=i;
ans=1;
for (j=0;a[j]*a[j]<=n;j++)
{
if (n%a[j]==0)
{
count1=0;
while (n%a[j]==0)
{
count1++;
n/=a[j];
}
ans*=(count1+1);
}
if (n==1)
break;
}
if (n>1)
ans*=2;
for (j=0;a[j]*a[j]<=ans;j++)
{
if (ans%a[j]==0)
break;
}
if (ans%a[j]==0)
d=ans/a[j];
else
continue;
if ((b[d]==true && d%2!=0) && (d!=a[j]))
{
count2++;
if (count2%9==0)
printf ("%ld\n",i);
}
}
return 0;
}