You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
358 B
23 lines
358 B
2 years ago
|
num = 2520
|
||
|
|
||
|
factors = [i for i in range(1, 20+1)]
|
||
|
|
||
|
|
||
|
def perf_num(num):
|
||
|
for f in factors:
|
||
|
if num % f == 0:
|
||
|
pass
|
||
|
else:
|
||
|
return False
|
||
|
else:
|
||
|
return True
|
||
|
|
||
|
i = 1
|
||
|
while True:
|
||
|
if i % 1000 == 0:
|
||
|
print("status", i, end='\r')
|
||
|
if perf_num(i):
|
||
|
print("found num", i)
|
||
|
break
|
||
|
i += 1
|