input: Write a python function to calculate the Mertens function.
  assert mertens_function(1) == 1
  assert mertens_function(5) == 1
  assert mertens_function(10) == 2
output: def mertens_function(n):
      def mobius_function(n):
          if n == 1:
              return 1
          p = 0
          i = 2
          while i * i <= n:
              if n % i == 0:
                  if n % (i * i) == 0:
                      return 0
                  n //= i
                  p += 1
              i += 1
          if n > 1:
              p += 1
          return -1 if p % 2 else 1
  
      mertens_sum = 0
      for k in range(1, n + 1):
          mertens_sum += mobius_function(k)
      return mertens_sum