TITLE: Size of largest square divisor of a random integer
QUESTION [12 upvotes]: Let $x$ be an integer picked uniformly at random from $1 \ldots N$. Write $x = r^2 t$ where $t$ is square-free. How does the expected value of $r$ scale with $N$? Is anything known about the variance of $r$?

REPLY [23 votes]: The asymptotic frequency of square-free integers is known to be $6/\pi^2$, see [1].
Denote by $P_n$ the uniform distribution on $[1,n]$ and by $E_n$ the corresponding expectation. Then
$$E_n(r)=\sum_{k \le \sqrt{n}} k P_n(r=k) \sim 
\sum_{k \le \sqrt{n}} k \cdot \frac{1}{k^2} \cdot\frac{6}{\pi^2} \sim \frac{3}{\pi^2} \log(n) \,,$$
where $A \sim B$ means that $A/B \to 1$ as $ n \to \infty$.
(In particular for $n=10^{10}$ the mean $E_n(r)$ is close to 7.)
Also,
$$E_n(r^2)=\sum_{k \le \sqrt{n}} k^2 P_n(r=k) \sim 
\sum_{k \le \sqrt{n}}  \frac{6}{\pi^2} \sim  \frac{6\sqrt{n}}{\pi^2} \,,
$$
so the variance of $r$ is asymptotic to $6\sqrt{n}/\pi^2$ as well.
[1] https://en.wikipedia.org/wiki/Square-free_integer

REPLY [6 votes]: Just a little empirical data up to $N=10^{10}$,
three superimposed random runs.
Growing roughly linearly w.r.t. $\log_{10} N$ within that range.