FunctionRacerProblemsRace

Perfect Number

EasyMathPython, JavaScript, TypeScript, Java, C++

A perfect number is a positive integer that equals the sum of its divisors that are smaller than itself. For instance 6 = 1 + 2 + 3.

Return True if num is perfect and False otherwise.

Example 1

num 28
returns true

1 + 2 + 4 + 7 + 14 = 28.

Example 2

num 12
returns false

1 + 2 + 3 + 4 + 6 = 16.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems