def f(num):
return num
number = f(13195)
list = [ x for x in range(number) if ((x!= 0 and x!=1) and number%x ==0)] #x (the multiplication factor) should not be 0 or 1
max = max(list)
for num in range(1,max) :
if all(num%i!=0 for i in range(2,num)):
if num in list:
print num
Hello, this code is used to find the biggest prime of a number. i have tried using f(13195) and i found the correct numbers, but I got an error of too many items in range, is there any other way of solving this?
But when I typed 600851475143,it says the range has too many items, however, does it mean I should not use range? Thanks in advance !