- Express
*x*in base 3. - Replace the first 1 with a 2 and everything after it with 0.
- Replace all 2s with 1s.
- Interpret the result as a binary number. The result is
*c*(*x*).

This function is the most frequently cited example of a real function that is continuous but not absolutely continuous. It has no derivative at any member of the Cantor set; its derivative is 0 elsewhere. Extended to the left with value 0 and to the right with value 1, it is the cumulative probability distribution function of a random variable that is uniformly distributed on the Cantor set. This probability distribution has no discrete part, i.e., it does not concentrate positive probability at any point. It also has no part that can be represented by a density function; integrating any putative probability density function that is not almost everywhere zero over any interval will give positive probability to some interval to which this distribution assigns probability zero. See Cantor distribution. The Cantor function is the standard example of what is sometimes called a devil's staircase.

Below we define a sequence of functions *f*_{n} on the interval that converges to the Cantor function.

Then *f*_{n+1}(*x*) will be defined in terms of *f*_{n}(*x*).

Let *f*_{n+1}(*x*) = 0.5 *f*_{n}(3*x*) when 0 ≤ *x* ≤ 1/3.

Let *f*_{n+1}(*x*) = 0.5 when 1/3 ≤ *x* ≤ 2/3.

Let *f*_{n+1}(*x*) = 0.5 + 0.5 *f*_{n}(3 (*x* − 2/3)) when 2/3 ≤ *x* ≤ 1.