MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / abundant

Function abundant

maths/special_numbers/weird_number.py:32–48  ·  view source on GitHub ↗

>>> abundant(0) True >>> abundant(1) False >>> abundant(12) True >>> abundant(13) False >>> abundant(20) True # >>> abundant(-12) # True

(n: int)

Source from the content-addressed store, hash-verified

30
31
32def abundant(n: int) -> bool:
33 """
34 >>> abundant(0)
35 True
36 >>> abundant(1)
37 False
38 >>> abundant(12)
39 True
40 >>> abundant(13)
41 False
42 >>> abundant(20)
43 True
44
45 # >>> abundant(-12)
46 # True
47 """
48 return sum(factors(n)) > n
49
50
51def semi_perfect(number: int) -> bool:

Callers 1

weirdFunction · 0.85

Calls 1

factorsFunction · 0.85

Tested by

no test coverage detected