Solution
= Solution
Both $B$ and its complement are dense. Indeed, inside any sufficiently small ternary cylinder, extend its finite digit prefix by a tail containing infinitely many $1$s to obtain a point of $B$, or by a tail of all zeros to obtain a point outside $B$. Therefore every nondegenerate interval has supremum one and infimum zero for the indicator function. Its upper integral is one and its lower integral is zero, so
$$
\boxed{f\text{ is not Riemann integrable}}.
$$