You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
416 B
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
bool check(int x)
{
int sum = 0;
for (long long i = 1; i < x; i++)
if (x % i == 0) sum += i;
return sum == x;
}
int main()
{
for (int i = 1; i <= 10000000; i++)
{
if (check(i))
printf("%d\n", i);
}
return 0;
}