Let $C$ be the Cantor set as a compact Abelian topological group, isomorphic to countable product of $\mathbb{Z}/2\mathbb{Z}$.


Its normalized Haar measure is denoted by $\mu$.



> 
> Is there a positive continuous map $f:C \to \mathbb{Q}$ which is not a locally constant map but satisfy $\int\_{C} f^{2}d\mu=1 $?
> 
> 
> Is there a positive continuous map $f:C \to \mathbb{Q}$ which is not a locally constant map but satisfy $\int\_{C} f^{3}d\mu=1 $?
> 
> 
> 


In the other word does $\int\_{C} f^{2}d\mu=1 $ or $\int\_{C} f^{3}d\mu=1 $ imply that $f$ is locally constant?


This question can be considered as a generalization of the equation $\sum\_{i=1}^{n} x\_{i}^{2}=1$ or $\sum\_{i=1}^{n} x\_{i}^{3}=1$ on $\mathbb{Q}^{n}$.



Rational valued functions on the Cantor set with $\int_{C} f^{3}d\mu=1 $
No. For example, let $S\_n=\{x\in C\colon x\_1=x\_2=\ldots=x\_{n-1}=0; x\_n=1\}$.
Now inductively choose a sequence of rationals $q\_n$ such that $\sum\_{n=1}^N q\_n^2\mu(S\_n)\in (1-2\cdot 3^{-N},1-3^{-N})$. You can check you have $q\_n=\Theta(2^n/3^n)$, so that 1) $f$ takes countably many values; 2) $f(x)\to 0$ as $x\to 0$, whence $f$ is continuous. 


