# Non-constant continuous function that is locally constant almost everywhere

Find an example of a continuous function $f: [0,1] \to [0,1]$ such that:

• $f(0) = 0$
• $f(1) = 1$
• $f$ is locally constant almost everywhere

I know I need to come up with a function that fails to be locally constant on some subset of $[0,1]$ which has measure zero, but I'm struggling to see how any such function would remain continuous when it still has to be locally constant outside this subset. Any tips would be appreciated.

• What about the Cantor function en.wikipedia.org/wiki/Cantor_function? – mfl Dec 16 '16 at 20:15
• Thanks, looks right, I hadn't heard of it so trying to get my head around the definition at the moment – Myopic Dec 16 '16 at 20:42