Returns prime factors of n as a list.
(n)
| 10 | |
| 11 | |
| 12 | def prime_factors(n): |
| 13 | """ |
| 14 | Returns prime factors of n as a list. |
| 15 | """ |
| 16 | i = 2 |
| 17 | factors = [] |
| 18 | while i * i <= n: |
| 19 | if n % i: |
| 20 | i += 1 |
| 21 | else: |
| 22 | n //= i |
| 23 | factors.append(i) |
| 24 | if n > 1: |
| 25 | factors.append(n) |
| 26 | return factors |
| 27 | |
| 28 | |
| 29 | def mobius_function(n): |
no test coverage detected