MeetCode
Perfect Number Check
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Run
Submit
Dark
Problem Statement
Solutions
Submissions
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
Input
28
Output
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
Wrap
Copy
Compute sum of proper divisors using divisor loop, exclude n itself, compare with n.
Please
login
to submit solutions.
Editor
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Test Cases
Output
Submission Result
Input
28
Expected Output
YES
Compile Output
Error
Output
Please
login
to submit solutions.