Problem 52684. Easy Sequences 17: Mu Variant Function
The mobius function is an important arithmetic function. It is often represented by the Greek letter mu (μ), and is sometimes called the "mu function".
In this excercise, we are concerned with a simplified variant of the mobius function called 'muVar'. For a given positive integer 'n', 'muVar(n)' is defined as:
- equal to 2, if 'n' has at least 1 perfect square divisor greater than 1; or
- equal to 1, otherwise.
For example, the values of muVar for 1, 10, 20, 30 and 100 are 1, 1, 2, 1 and 2, respectively.
Our task is to create the function 'muVarSum(n)', which is the sum of the outputs of 'muVar' function applied from 1 to n.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
93 Solvers
-
Project Euler: Problem 16, Sums of Digits of Powers of Two
177 Solvers
-
Pandigital Multiples of 11 (based on Project Euler 491)
52 Solvers
-
Determine whether a number is practical
7 Solvers
-
Determine if Input is Oddish or Evenish (Odd/Even Sum of Digits)
320 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!