The Möbius function is defined for positive integers by , for distinct primes , and 0 otherwise. The Mertens function is the cumulative sum of the Möbius function.

The left graphic shows the first values of the Möbius function, reading right-to-left and top-to-bottom, and coded by color using red for -1, green for 0, and blue for 1. The right graphic shows the corresponding values of the Mertens function; values that are not -1, 0, or 1 are shown in levels of gray.