mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-18 18:14:34 +08:00
snake_case all the things
This commit is contained in:
17
project_euler/problem_03/sol2.py
Normal file
17
project_euler/problem_03/sol2.py
Normal file
@ -0,0 +1,17 @@
|
||||
'''
|
||||
Problem:
|
||||
The prime factors of 13195 are 5,7,13 and 29. What is the largest prime factor of a given number N?
|
||||
e.g. for 10, largest prime factor = 5. For 17, largest prime factor = 17.
|
||||
'''
|
||||
from __future__ import print_function
|
||||
n=int(raw_input())
|
||||
prime=1
|
||||
i=2
|
||||
while(i*i<=n):
|
||||
while(n%i==0):
|
||||
prime=i
|
||||
n/=i
|
||||
i+=1
|
||||
if(n>1):
|
||||
prime=n
|
||||
print(prime)
|
Reference in New Issue
Block a user