Classify by Divisors
A number can be classified by the sum of its proper divisors, which are its positive divisors excluding the number itself. The function classify receives number and returns perfect if the sum equals the number, abundant if the sum is greater, and deficient if the sum is smaller. If number is less than or equal to 0, raise ValueError.
Примеры
Ввод
6Вывод
"perfect"Ввод
28Вывод
"perfect"Ввод
12Вывод
"abundant"Нужно реализовать
def classify(number: int) -> str:
Теги
math
Connectez-vous pour voir l'historique des soumissions
Se connecterConnectez-vous pour utiliser le Mentor IA
Se connecterVisible tests
1
Input
6Expected
"perfect"2
Input
28Expected
"perfect"3
Input
12Expected
"abundant"4
Input
8Expected
"deficient"5
Input
1Expected
"deficient"6
Input
33550336Expected
"perfect"Focus radio
Paused · SomaFM · Fluid