#C3516. Sum of Proper Divisors and Prime Check

    ID: 46952 Type: Default 1000ms 256MiB

Sum of Proper Divisors and Prime Check

Sum of Proper Divisors and Prime Check

Given an integer ( n ), a proper divisor of ( n ) is a number that divides ( n ) but is strictly less than ( n ). In other words, the sum of proper divisors is defined as: [ S(n)=\sum_{\substack{d|n,, d<n}} d ]

For each test case, compute ( S(n) ) and then determine whether ( S(n) ) is a prime number. Output the sum and print "YES" if it is prime, otherwise print "NO".

inputFormat

The first line contains an integer ( t ), representing the number of test cases. Each of the following ( t ) lines contains a single integer ( n ).

outputFormat

For each test case, output a single line containing two items: the sum of proper divisors of ( n ) and either "YES" if the sum is a prime number or "NO" otherwise. Separate the two outputs with a space.## sample

3
6
28
9
6 NO

28 NO 4 NO

</p>