Mobius Function of n is,
1, if n is a square-free number with even number of prime factors
-1, if n is a square-free number with odd number of prime factors
0, if n has a squared prime factor
Computing mobius(n) using Linear Sieve
References
https://en.wikipedia.org/wiki/M%C3%B6bius_function
https://codeforces.com/blog/entry/54090
https://cp-algorithms.com/algebra/prime-sieve-linear.html