Skip to content

Commit f05abe4

Browse files
Update proth_number.py
1 parent 58b6288 commit f05abe4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

maths/special_numbers/proth_number.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ def is_proth_number(number: int) -> bool:
6363
"""
6464
:param number: positive integer number
6565
:return: true if number is a Proth number, false otherwise
66+
>>> is_proth_number(1)
67+
False
68+
>>> is_proth_number(2)
69+
False
70+
>>> is_proth_number(3)
71+
True
6672
>>> is_proth_number(5)
6773
True
6874
>>> is_proth_number(34)
@@ -84,6 +90,9 @@ def is_proth_number(number: int) -> bool:
8490
message = f"Input value of [{number=}] must be > 0"
8591
raise ValueError(message)
8692

93+
if number == 1:
94+
return False
95+
8796
number -= 1
8897
n = 0
8998
while number % 2 == 0:
@@ -107,7 +116,7 @@ def is_proth_number(number: int) -> bool:
107116

108117
print(f"The {number}th Proth number: {value}")
109118

110-
for number in [3, 5, 9, 13, 49, 57, 193, 241, 163, 201]:
119+
for number in [1, 2, 3, 5, 9, 13, 49, 57, 193, 241, 163, 201]:
111120
if is_proth_number(number):
112121
print(f"{number} is a Proth number")
113122
else:

0 commit comments

Comments
 (0)