Perfect Number Check

Perfect Number Check

Hard Computer Mathematics Integers & Divisibility 31 views
Explanation Complexity

Problem Statement

Check if n is a perfect number (sum of proper divisors equals n).

Input Format

One integer n.

Output Format

YES or NO.

Example

28
YES

Constraints

1

Input / Output Format

Input Format
One integer n.
Output Format
YES or NO.
Constraints
1

Examples

Input:
28
Output:
YES

Example Solution (Public)

Computer Mathematics
Compute sum of proper divisors using divisor loop, exclude n itself, compare with n.

Official Solution Code

Compute sum of proper divisors using divisor loop, exclude n itself, compare with n.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.