answersLogoWhite

0


Best Answer

def factors(n):

return [(x, sum([1 for y in range(1,int(ceil(log(n, x)))+1) if n%x**y == 0])) for x in range(2,int(n/2)) if all([x%q!=0 for q in range(2,int(x/2)+1)]) and n % x == 0]

This will give you a list of factors with their exponents:

print(factors(60))

# prints: [(2, 2), (3, 1), (5, 1)]

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How you can write python code to disply the prime factors of 60?
Write your answer...
Submit
Still have questions?
magnify glass
imp