Ratio of triangular numbers Which natural numbers can be written as the ratio of two triangular numbers?
That is, which natural numbers can be written as
$$\frac{n(n+1)}{m(m+1)}$$ for natural numbers $m,n$.
 A: A small complement to the nice answers so far: there are infinitely many squares that are not the ratio of two triangular numbers. 
Indeed, with Gjergji Zaini's notation, let $k=p+1$, where $p\equiv 3\pmod{4}$ is a prime. Then the equation
$$k^2-1=(ky-x)(ky+x)$$
becomes
$$p(p+2)=((p+1)y-x)((p+1)y+x).$$
The first factor on the right is at most $p$, hence if $p$ divides this factor, then the factors on the right are $p$ and $p+2$, so that $y=1$, which corresponds to $n=0$. If $p$ divides the second factor on the right, then the factors on the right are $q$ and $pr$ such that $qr=p+2$. Now
$$q-r\equiv q+pr=2(p+1)y\equiv 0\pmod{p+1},$$
hence $|q-r|\geq p+1$, which forces $q=1$ and $r=p+2$ (since $1\leq q\leq p$). In other words, the factors on the right are $1$ and $p(p+2)$, so that $y=(p+1)/2$. The last expression is even, hence it does not correspond to any $n$.
A: Any non-square $d$ can be written in this way. We need to solve $n(n+1)=dm(m+1)$, and multiplying by 4 and setting $a=2n+1$, $b=2m+1$ we get
$$a^2-db^2=1-d$$
and we need to solve this in odd integers $a$ and $b$ other than $a,b=\pm1$ (which give division by zero when we sub back). But we can do this -- $a=1$ and $b=1$ is one solution, and if we choose a unit $u>1$ in $R=\mathbf{Z}[\sqrt{d}]$ congruent to 1 mod $2R$ (such a thing exists by general theory) then $(1+\sqrt{d})u=a+b\sqrt{d}$ gives a solution congruent to 1 mod $2R$ and hence $a$ and $b$ are odd giving us a solution to the original question.
Here's an example: set $d=97$. Then $u=62809633+6377352\sqrt{97}$ is a unit
congruent to 1 mod 2, and $(1+\sqrt{97})(62809633+6377352\sqrt{97})=681412777+69186985\sqrt{97}$ giving $n=340706388$ and $m=34593492$. This probably isn't the smallest solution but on the other hand it was easy to generate because pari can compute units in real quadratic fields super-quickly.
For $d$ a square it seems a bit more delicate. Say $d=r^2$. If $r=2$ mod 4 then $n=(r^2-4)/4$ and $m=(r-2)/4$ works so this gives a solution for $d=6^2,10^2,14^2\ldots$. But in the remaining cases there might not be a simple criterion -- the question seems to involve (amongst other things) factorizing $r^2-1$ into two factors other than $r+1\times r-1$ but whose sum is $2r$ mod $4r$, and this is perhaps the sort of thing that can be done sometimes but can't be done sometimes. For example $35^2-1=6\times 204$ and (omitting the details, which are not hard) this yields $n=49$ and $m=1$. A computer search for such factors shows that $d^2$ can be written as a ratio of triangular numbers for $d=35,99,195,204,323,483,675,899,980,1155,\ldots$ and the $2$ mod $4$ cases.
A: Kevin already finished the non-square part. Suppose $$\frac{m(m+1)}{n(n+1)}=k^2$$ then denoting $x=2m+1,y=2n+1$, we get the form $$k^2-1=(ky-x)(ky+x).$$
So there is an integer $a$ so that $ky-x=a, ky+x=\frac{k^2-1}{a}$, in particular $$2y=\frac{k^2+a^2-1}{ka}\in \{6,10,14,\dots\}=S$$ because $y$ is odd and $>1$. It is easy to show that this happens if only if $(a,k)$ are consecutive terms in the sequence
$$a_0=1,a_1=2y,a_{n+1}=2ya_n-a_{n-1}.$$ So $k^2$ is the ratio of two triangular numbers iff
$$k\in \bigcup_{m\in S}\{1,m,m^2-1,m^3-2m,\dots\}$$ where $S$ consists of all numbers $2\pmod{4}$ that are greater than $2$.
