Let $f(n)$ denotes the product of all the positive divisors of n, and $\varphi(n)$ denotes the sum of all the positive divisors of $n$. If number $n$ is to be randomly selected from the first $100$ positive integers, what is the probability that $f(n) - \varphi(n)$ is an even number?
So far, I know that $f(n)$ and $\varphi(n)$ need to be either both odd or both even. If $n$ is odd, then $f(n)$ must also be odd; if $n$ is even, then $f(n)$ must also be even. However, I have difficulty calculating when $\varphi(n)$ is odd or even. It appears to be completely random.
$f(n)$ is odd whenever $n$ is odd and even whenever $n$ is even because when $n$ is even there is a factor $2$.
$\varphi(n)$ is multiplicative-we have $\varphi(nm)=\varphi(n)\varphi(m)$ whenever $n$ and $m$ are coprime. If $n=p^k$ for $k$ an odd prime, $\varphi(p^k)$ is even when $k$ is odd, but $\varphi(2^k)$ is always odd. This means that $\varphi(n)$ is even when $n$ has at least one factor of an odd prime raised to an odd power and odd otherwise. For example, all multiples of $3$ that are not multiples of $9$ have an even sum of factors because we have all the factors without a factor $3$ and all the factors with a factor $3$, making $4$ times the sum of all the factors without a factor $3$.
For odd $n$ the only ones with $\varphi(n)$ odd are $9,25,49$, so $47$ odd numbers have $f(n)-\varphi(n) odd.
For even $n$ the only ones with $\varphi(n)$ odd are $18,36,54,72,90,50,80$ so $7$ even numbers have $f(n)-\varphi(n)$ odd.
The chance a number $n$ in the range $1$ to $100$ inclusive has $f(n)-\varphi(n)$ even is $\frac {51}{100}$