Problem 3003. Mobius function
- μ(n) = 1 if n is a square-free positive integer with an even number of prime factors.
- μ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.
- μ(n) = 0 if n has a squared prime factor.
Solution Stats
Problem Comments
-
3 Comments
Hello Grant. It's a nice set, but for problems 3001 and 3002 lookup tables are "always win" solutions. For this problem you can avoid this by using some randomness in the test suite.
I'm glad you like them, and thanks for the feedback. I just added a random test case to all three problems.
Yeah, the series is good. After a few rounds of spam-storm, Cody seems to be back on track...
Solution Comments
Show commentsProblem Recent Solvers50
Suggested Problems
-
Least common multiple of many numbers
227 Solvers
-
Flag largest magnitude swings as they occur
670 Solvers
-
Lychrel Number Test (Inspired by Project Euler Problem 55)
94 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
368 Solvers
-
Side of an equilateral triangle
5792 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!