forked from annuraagggIIIT/Problem-Solving
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst10oddmultiples.cpp
More file actions
39 lines (34 loc) · 1.47 KB
/
first10oddmultiples.cpp
File metadata and controls
39 lines (34 loc) · 1.47 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
#include<iostream>
#include<vector>
using namespace std;
vector<int> check10(int x){
vector<int> out;
int size = 0;
// 1 not counted as odd multiple
for(int i=3; i < (x/2) && size != 10; i+=2){
if(x%i == 0){
out.push_back(i);
size++;
}
}
return out;
}
/*
The 192 factors of 360,360 are:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 20, 21, 22, 24, 26, 28, 30, 33, 35, 36, 39, 40, 42, 44, 45, 52, 55, 56,
60, 63, 65, 66, 70, 72, 77, 78, 84, 88, 90, 91, 99, 104, 105, 110, 117, 120, 126, 130, 132, 140, 143, 154, 156, 165, 168, 180,
182, 195, 198, 210, 220, 231, 234, 252, 260, 264, 273, 280, 286, 308, 312, 315, 330, 360, 364, 385, 390, 396, 420, 429, 440, 455,
462, 468, 495, 504, 520, 546, 572, 585, 616, 630, 660, 693, 715, 728, 770, 780, 792, 819, 840, 858, 910, 924, 936, 990, 1001, 1092, 1144,
1155, 1170, 1260, 1287, 1320, 1365, 1386, 1430, 1540, 1560, 1638, 1716, 1820, 1848, 1980, 2002, 2145, 2184, 2310, 2340, 2520, 2574,
2730, 2772, 2860, 3003, 3080, 3276, 3432, 3465, 3640, 3960, 4004, 4095, 4290, 4620, 4680, 5005, 5148, 5460, 5544, 5720, 6006, 6435, 6552,
6930, 8008, 8190, 8580, 9009, 9240, 10010, 10296, 10920, 12012, 12870, 13860, 15015, 16380, 17160, 18018, 20020, 24024, 25740, 27720, 30030,
32760, 36036, 40040, 45045, 51480, 60060, 72072, 90090, 120120, 180180, 360360
*/
int main(){
int test = 360360;
for(int x: check10(test)){
cout<<x<<" ";
}
cout<<endl;
return 0;
}