Defines Mobius function
(n)
| 27 | |
| 28 | |
| 29 | def mobius_function(n): |
| 30 | """ |
| 31 | Defines Mobius function |
| 32 | """ |
| 33 | factors = prime_factors(n) |
| 34 | if is_square_free(factors): |
| 35 | if len(factors) % 2 == 0: |
| 36 | return 1 |
| 37 | elif len(factors) % 2 != 0: |
| 38 | return -1 |
| 39 | else: |
| 40 | return 0 |
nothing calls this directly
no test coverage detected