Proving the function c : N → N defined by c(n) = the number of digits of $n^2$ is surjective I have an idea on how to implement this in proof talk but I'm not quite there.
If $n = 10^x$, then $n^2= 10^{2x}$ which has $2x+1$ digits but I don't know where to go from there.
Any help?
 A: You just need to provide an $n$ for each $m\in \Bbb N$ such that $c(n) = m$. You've already got half of them: if $m = 2k+1$ is odd, then $n= 10^k$ works.
The other half is to just add or remove exactly one digit. Well, if you cut $10^k$ in half, then squaring will cut $10^{2k}$ in quarter, which will have one less digit*. So, if $m=2k$ is even, then $n= 10^k /2$ works.
*because we would need to cut by a factor of more than $10$ to reduce the number of digits by more than $1$
A: If $n$ is odd, then there surely is a square with $n$ digits, namely $10^{n-1}$.
For even $n>0$, take $10^{n/2}-1$ and square it. Now prove that
$$
10^{n-1}\le 10^n-2\cdot10^{n/2}+1<10^n
$$
A: If $m\ge3$ and $m^2$ has $n$ digits, then $m^2<(m+1)^2=m^2+2m+1<m^2+3m\le2\cdot m^2$ so that $(m+1)^2$ has either $n$ or $n+1$ digits. Then the result follows because any sequence of natural numbers that begins with $1$, is unbounded, and grows by at most $1$ per step, is quite clearly surjective.
This method works also for the number of digits of cubes or fourth powers. It even works for the number of digits of 2023rd powers if we replace “surjective” with “surjective up to finely many exceptions”.
A: One of $m$ or $m+1$ is even, so either $10^m$ or $10^{m+1}$ is a square.
Because $3 \lt \sqrt{10}$, there must be an integer $k$ such that $10^m \leq k^2 \lt 10^{m+1}=10 \cdot 10^m$.  If $10^{m+1}=k^2$, then $c \left (\frac k3 \right)=m$
