TITLE: Number theory problem on divisors!
QUESTION [5 upvotes]: For any positive integer $n$, let $d(n)$ denote the number of positive divisors of $n$ (including $1$ and itself). Determine all positive integers $k$ such that $$\frac{d\left(n^2\right)}{d(n)} = k$$ for some $n$.

Please help me solve this number theory problem. I have tried a lot and found two values of k, $1$ and $3$, but I don't know if there are some others.

REPLY [4 votes]: All odd numbers and only them are representable in the form $d(n^2)/d(n)$. But the proof is tricky! 
It is clear that no even number is representable as the numerator is always odd. 
For $k$ odd we proceed by induction, clearly $1 = d(1^2)/d(1)$ so $1$ is representable. Now suppose that $k>1$ and that all odd integers up to $k-2$ are representable then if $2^a$ is the largest power of $2$ that divides $k+1$, write 
$$ k = 2^at-1 $$
with $t$ odd and $a \ge 1$, then 
$$ (2^a-1)k = 2^{a+1}(2^{a-1}t-\tfrac{t+1}2)+1 = 2^{a+1}b+1$$
whith $b = 2^{a-1}t-\tfrac{t+1}2$. Now we see that $2b+1 = (2^a-1)t$ and so:
$$ \frac{2^{a+1}b+1}{2^ab+1}\cdot \frac{2^{a}b+1}{2^{a-1}b+1}\cdot \dots \cdot \frac{2^2b + 1}{2b+1} = \frac{(2^a-1)k}{(2^a-1)t} = \frac{k}{t}$$
As $t < k$ is odd, using the induction hypothesis we can find $m$ such that 
$$ t = \frac{d(m^2)}{d(m)} $$
But then chosing primes $p,q,\dots,s$ coprime with $m$ we find that
$$ n = p^{2^{a}b}q^{2^{a-1}b}\dots s^{2b} m $$ 
verifies
$$ \frac{d(n^2)}{d(n)} = \frac{d(p^{2^{a+1}b}q^{2^{a}b}\dots s^{2^2 b})}{d(p^{2^{a}b}q^{2^{a-1}b}\dots s^{2 b})} \cdot \frac{d(m^2)}{d(m)} = \frac{k}t\cdot t = k$$
and the proof is complete!.