-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDIV.cpp
More file actions
82 lines (82 loc) · 1.76 KB
/
DIV.cpp
File metadata and controls
82 lines (82 loc) · 1.76 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
===================================================
Name :- Nishant Raj
Email :- raj.nishant360@gmail.com
College :- Indian School of Mines
Branch :- Computer Science and Engineering
Time :- 21 October 2015 (Wednesday) 09:46
===================================================*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define mod 1000000009
bool check[1009];
vector<int> prime;
void shieve()
{
for(int i=3;i*i<=1000;i+=2)
{
if(!check[i])
{
for(int j=i*i;j<=1000 ; j+=i)
check[j]=1;
}
}
prime.pb(2);
int j=1;
for(int i=3;i<=1000;i+=2)
{
if(!check[i]){
prime.pb(i);
}
}
}
bool isPrime(int n){
if(n == 1)
return false;
for(int i = 2 ; i*i <= n ; i++){
if(n%i == 0)
return false;
}
return true;
}
int main()
{
shieve();
int ma = -1;
int pos = 0;
for(int i=1;i<=1000000;i++)
{
int temp=i;
int total=1;
int k=0;
for(int j=prime[k]; k < prime.size() && j*j<=temp;j=prime[++k])
{
int count=0;
while(temp%j==0)
{
count++;
temp/=j;
}
total *=count+1;
}
if(temp!=1)
total*=2;
k = 0;
for(int j = prime[k] ;k<prime.size() && j*j <= total ; j = prime[++k]){
if(total%j == 0){
int x = total / j;
if(x!= j && isPrime(x)){
pos++;
if(pos%9 == 0)
printf("%d\n", i);
break;
}
}
}
}
return 0;
}