Topic address
The main idea: S (n) is the sum of the true factors of n of positive integers, a factor that is less than n and divisible by n, such as S (12) =1+2+3+4+6=16. If any number m,s (m) is not equal to N, then it is said that N is a non-touch number, and that the number within 1000 is not a number.
To solve the problem: to determine whether a number n is not a number, we must determine whether there is not a positive integer m of the sum of the true factor, it will be within 1000 of the sum of the true factor to find the sum of the true factor and the Sieve method
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>
using namespace std;
const int MAXN = 1000000+10;
const int MAXM = 1000+10;
int SUM[MAXN],SIGN[MAXM];
int main ()
{
memset (sum,0,sizeof (sum));
memset (sign,0,sizeof (sign));
for (int i = 1; I <= 500000; i++)/sieve method to find S (n) and save it with sum of the array
{for
(int j = 2*i; J <= 1000000; j = i)
{
SUM[J] + = i
}
}
for (int i = 1; I <= 1000000 i++)//1000 of S (m)
if (Sum[i] < 1000)
sign[sum[i] = 1;
int t,n;
scanf ("%d", &t);
while (t--)
{
scanf ("%d", &n);
if (!sign[n])
puts ("yes");
Else
puts ("no");
return 0;
}