references https en wikipedia orgwikimc3b6biusfunction references wikipedia square free number psfblack true ruff true mobius function mobius24 0 mobius1 1 mobius asd traceback most recent call last typeerror not supported between instances of int and str mobius10400 0 mobius10400 1 mobius1424 1 mobius1 2 2 0 traceback most recent call last typeerror not supported between instances of int and list mobius function mobius 24 0 mobius 1 1 mobius asd traceback most recent call last typeerror not supported between instances of int and str mobius 10 400 0 mobius 10 400 1 mobius 1424 1 mobius 1 2 2 0 traceback most recent call last typeerror not supported between instances of int and list
from maths.is_square_free import is_square_free
from maths.prime_factors import prime_factors


def mobius(n: int) -> int:
    
    factors = prime_factors(n)
    if is_square_free(factors):
        return -1 if len(factors) % 2 else 1
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()