Perfect Number Check

A perfect number is equal to the sum of its proper positive divisors. Proper divisors are the divisors of a number excluding the number itself: for 6, they are 1, 2, and 3. The function perfect receives number and returns True if it is perfect, otherwise False.

Примеры

Ввод
27
Вывод
False
Ввод
28
Вывод
True
Ввод
29
Вывод
False

Нужно реализовать

def perfect(number: int) -> bool:

Теги

math
PostgreSQLv16

Tu sa zobrazí výsledok spustenia kódu

Visible tests
1
Input
27
ExpectedFalse
2
Input
28
ExpectedTrue
3
Input
29
ExpectedFalse
4
Input
6
ExpectedTrue
5
Input
12
ExpectedFalse
6
Input
496
ExpectedTrue
Focus radio
Paused · SomaFM · Fluid