I'm trying to prove that the ratio of triangular numbers is dense on the interval from 0 to 1. More precisely, given $l\in[0,1]$ and $\varepsilon>0$, we can find $m,n \in \mathbb{N}$ so that $|\frac{m(m+1)}{n(n+1)}-l|<\varepsilon$.
I came up with an algorithm that seems to work, but I don't know how a proof would look.
Suppose $\varepsilon>0$ and $l\in[0,1]$ are given. Then use the following algorithm to determine $m$ and $n$:
Set $m_0=1$ and $n_0=2$.
Set $k=0$.
while $|\frac{m_k(m_k+1)}{n_k(n_k+1)}-l| \geq \varepsilon$
{
if $\frac{m_k(m_k+1)}{n_k(n_k+1)}
Set $m_{k+1}=m_k+1$ and $n_{k+1}=n_k$
if $\frac{m_k(m_k+1)}{n_k(n_k+1)}>l$
Set $m_{k+1}=m_k$ and $n_{k+1} = n_k+1$
Otherwise:
Set $m_{k+1}=m_k+1$ and $n_{k+1}=n_k+1$
$k = k+1$
}
This seems to work. Could the algorithm be rewritten as a proof using the nested interval theorem? If so, I'm having a hard time seeing how. The idea would be to use the Archimedean principal to find a triangular ratio $p_0$ with $p_0