Question: Use a code in Python programming language to answer the following question. # The prime factors of 13195 are 5, 7, 13 and 29. #
Use a code in Python programming language to answer the following question.
# The prime factors of 13195 are 5, 7, 13 and 29.
# What is the largest prime factor of the number 75143?
I used this code and I cannot understand what is wrong with it. The comment that my professor left me is this "
Py#3, you used math.sqrt(75143) for your range limit. That is not the correct limit (hint, the correct answer is 461, you found the other prime of 163)"
import math
for i in range(int(math.sqrt(75143)),1,-1) :
if 75143 % i ==0 :
flag = False
for y in range (int(math.sqrt(i)),1,-1) :
if(i % y ==0):
flag = True
if (flag!=True) :
print(i)
break
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
