Super Simple Python: Prime Factorization

preview_player
Показать описание
The Super Simple Python Series is meant to be a primer on Python. These projects will get you familiar with the language and some of its libraries.
Рекомендации по теме
Комментарии
Автор

if I do "while n <= num", I get the same result. Why should I do "while n**2 <= num"?

dmitry
Автор

I have a question regarding the step n**2 <= num ; so I understood that this means that the prime factors of a number all exist less than or equal the square root of a number num. But in the case of num as 28, it has a prime factor of 7, and 7 squared is not less than or equal 28, but somehow the code also worked and i got 7 included in the prime factors as a result. So does this code only checks prime factors less than or equal to square root of a number ? or did i get this wrong as somehow it also worked correct with 28; maybe this while statement only means that for n less than or equal square root of the number to divide num by n??

RowanSallam
Автор

What is the names of the algorithm used in here?
Does it have a mathmatical name?

foadrezaei