#C1130. Sum of Proper Divisors and Prime Check

    ID: 40601 Type: Default 1000ms 256MiB

Sum of Proper Divisors and Prime Check

Sum of Proper Divisors and Prime Check

Given a positive integer n, compute two values:

  • The sum of all proper divisors of n (i.e. all positive divisors excluding n itself). In mathematical terms, if we define $$ \sigma(n) = \sum_{\substack{d|n \\ d<n}} d, $$ then you are to compute \( \sigma(n) \).
  • A boolean value indicating whether n is a prime number. Recall that a prime number is a natural number greater than 1 that has no positive divisors other than 1.

Note that if n equals 1, then by definition its proper divisor sum is 0 and it is not considered prime.

Example:

Input: 28
Output: 28 False

Explanation: The proper divisors of 28 are {1, 2, 4, 7, 14} and their sum is 28. Since 28 has divisors other than 1 and itself, it is not prime.

</p>

inputFormat

The input consists of a single integer n provided via stdin.

Constraints:

  • n is a positive integer. Note that when n equals 1, the output should be 0 False.

outputFormat

Output two values to stdout separated by a space:

  • The sum of all proper divisors of n.
  • A boolean value (True or False) indicating whether n is a prime number.
## sample
28
28 False

</p>