-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerfect Number 2.cpp
More file actions
52 lines (46 loc) · 980 Bytes
/
Perfect Number 2.cpp
File metadata and controls
52 lines (46 loc) · 980 Bytes
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
// #include <iostream>
// #include <cmath>
// using namespace std;
// int main()
// {
// int T;
// int sum,N,j;
// cin >> T;
// while (T--)
// {
// cin >> N;
// for(int num=2;num<N;num++){
// sum=1;
// j = sqrt(num);
// for(int i=2; i<=j; i++)
// {
// if(num%i==0)
// sum =sum+i+num/i;
// }
// if(sum==num)
// cout<<num<<endl;
// }
// cout<<"\n";
// }
// return 0;
// }
#include <iostream>
using namespace std;
int main()
{
int T,num;
cin>>T;
int ara[5]={6,28,496,8128,33550336};
while (T--)
{
cin>>num;
for(int i=0;i<5;i++){
if(ara[i]<num)
cout<<ara[i]<<endl;
else
break;
}
cout<<"\n";
}
return 0;
}