Skip to content

Commit fa04fdf

Browse files
author
Juanitoupipou
committed
Fixing the issues of the isprothnumber function
1 parent 5f54615 commit fa04fdf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

maths/special_numbers/proth_number.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def proth(number: int) -> int:
5959
return proth_list[number - 1]
6060

6161

62-
def isProthNumber(number: int) -> bool :
62+
def isprothnumber(number: int) -> bool :
6363
"""
6464
:param number: nth number to calculate in the sequence
6565
:return: true if number is a Proth number, false etherwise
@@ -80,13 +80,13 @@ def isProthNumber(number: int) -> bool :
8080
msg = f"Input value of [number={number}] must be > 0"
8181
raise ValueError(msg)
8282

83-
N = number
84-
N -= 1
83+
num = number
84+
num -= 1
8585
n = 0
86-
while N%2 == 0 :
86+
while num%2 == 0 :
8787
N = N/2
8888
n += 1
89-
return N < (2**n)
89+
return num < (2**n)
9090

9191

9292

@@ -106,10 +106,10 @@ def isProthNumber(number: int) -> bool :
106106

107107
print(f"The {number}th Proth number: {value}")
108108

109-
list = [3, 5, 9, 13, 49, 57, 193, 241, 163, 201]
109+
listexe = [3, 5, 9, 13, 49, 57, 193, 241, 163, 201]
110110

111-
for number in list :
112-
if isProthNumber(number):
111+
for number in listexe :
112+
if isprothnumber(number):
113113
print(f"{number} is a Proth number")
114114
else :
115115
print(f"{number} is not a Proth number")

0 commit comments

Comments
 (0)