2

The sequence of triangular numbers is well known. Consider now the triangular numbers modulo some positive natural number $k$. That is, let $T_{n,k}$ be the remainder of dividing $T_n$ by $k$. For the regular sequence of triangular numbers, we can take as convention $T_n = T_{n, \infty}$.

Question: For all values of $k, i < k$, does there exists some $n$ such that $T_{n, k} = i$

Colm Bhandal
  • 4,649
  • 3
    Have you tried any examples? For $k=3$, say, doesn't the sequence just go ${0,1,0,0,1,0,0,1,\cdots}$? – lulu Feb 21 '17 at 12:41
  • @lulu Admittedly I have not tried any examples, though I do have a friend who is coding up something. Hmmm, I guess your surprisingly low value of $k$ provides a counter example! If you want to post as an answer, with a bit more of a rigorous proof that the sequence does indeed go on like that forever, I'll accept. Note: I can see it is correct, but I'm asking for the sake of rigour and readers of this site. Alternatively, I can write out the proof as an answer, just let me know which one. – Colm Bhandal Feb 21 '17 at 20:09
  • Feel free to write up your own argument. By the way, some quick experimenting with it led me to conjecture that your desired result holds if and only if $n$ is a power of $2$. Should be easy to prove the only if part, but the if part might be a good problem. – lulu Feb 21 '17 at 20:12
  • Wow!!! Post That as an answer and major kudos. I guess your only if part refutes my related question: http://math.stackexchange.com/questions/2155173/triangular-numbers-modulo-sufficiently-large-k-hit-all-values?noredirect=1&lq=1. – Colm Bhandal Feb 21 '17 at 20:17
  • Just wrote it up. As I thought, it's easy to see one direction...I don't immediately see how to handle general powers of $2$ but I haven't thought that hard about it and I might be missing something obvious. With a computer it should be easy to check the next few cases. – lulu Feb 21 '17 at 20:25
  • I just looked for it online...surprisingly hard to find a proof, though "my" conjecture appears to be well known. People cite Knuth. See, e.g., this reference – lulu Feb 21 '17 at 20:33

2 Answers2

3

It is easy to see that this is False if $k$ is not a power of $2$:

To do it we just need to see that it is false $\pmod p$ for odd primes $p$. But for odd primes $p$ we simply remark that, $\pmod p$, $T_n=\frac {n (n+1)}2$ only depends on $n\pmod p$ and both $T_0$ and $ T_{p-1}$ are $0\pmod p$.

Now, for $k=2^m$ it appears that it might be true. I have checked $k=2,4,8,16,32$ and it works for each. It would be interesting to resolve this for general powers of $2$.

EDIT: unsurprisingly, this appears to be known (if not exactly well known). Most authors credit Knuth, as in this reference.

EDIT (Based on comments): To expand on paragraph 2, consider the function $i \mapsto T_i \mod(p)$ for $i$ in $\{0, 1, \dots, p-1\}$. Since $T_0 \equiv T_{p-1} \equiv 0$, then , by the pigeon hole principle, there must be some $j$ in $\{0, 1, \dots, p-1\}$ not mapped by the function. Now, it remains to show that $T_{n} \equiv T_{n\bmod{p}}$ for all $n$, because then there can't be any $T_n$ such that $T_n \equiv j$.

Lemma: The triangle number at $n$ is congruent to the triangle number at the residue of $n$. $$T_{n} \equiv T_{n\bmod{p}}$$ Proof: Let $k$ be the residue of $n$ with respect to $p$. We know that $$n(n + 1) \equiv k(k + 1)$$ We also know that both sides of the equation must be even, so let $n(n + 1) = 2N$ and let $k(k + 1) = 2K$, then: $$2N \equiv 2K$$ and so, because we're working mod a prime $p > 2$, and all numbers less than a prime are coprime to it, we can divide the $2$ from both sides, giving the desired result.

Brian M. Scott
  • 616,228
lulu
  • 70,402
  • Lulu can you please expand on paragraph 2, I'm a bit lost, thanks. – Colm Bhandal Feb 21 '17 at 20:40
  • Are you used to modular arithmetic? Can you, for example, prove that if $p$ is an odd prime then $n\equiv m\pmod p\implies T_n\equiv T_m\pmod p$? If so, then note that this implies that we only need consider the $p$ values $T_0,T_1,\cdots, T_{p-1}$. Now, if these were all distinct we'd get all the possible remainders! But, alas, they aren't distinct....$T_0\equiv T_{p-1}\equiv 0\pmod p$. Not that this does not work for $p=2$. Indeed, $\pmod 2$, $T_0=0$ but $T_{2-1}=T_1=1$. – lulu Feb 21 '17 at 20:43
  • Lulu, thanks. I totally see it now. The key was the lemma. May I add it to your answer? – Colm Bhandal Feb 23 '17 at 10:42
  • If you think it helps, go ahead. – lulu Feb 23 '17 at 11:04
1

With Lulu's argument, and permission (thanks Lulu) I will answer this. The answer to the question is no. The counterexample is $k=3, i=2$.

We want to prove that for all $n$, $T_{n, 3} \neq 2$, noting that $T_{n+1} = T_n + n + 1$. Rather than prove this, we prove a theorem that implies this:

  • $T_{n, 3} = 1$ whenever $n \equiv 1$ (mod $3$)
  • $T_{n, 3} = 0$ otherwise.

We proceed by induction on $n$, noting that $T_{n,k} = r$ is the same thing as saying $T_n \equiv r$ (mod $k$).

Base case: $n = 0$, $T_n = 0$, $T_{n, 3}=0$ and we're done.

Inductive case: There are three sub-cases to consider:

  • If $n \equiv 1$ (mod $3$), then $n+1 \equiv 2$ (mod $3$), and by I.H. $T_n\equiv 1$ (mod $3$). By triangle number definition, $T_{n+1} = T_n + n + 1 \equiv 0$ (mod $3$), as required.

  • If $n \equiv 0$ (mod $3$), then $n+1 \equiv 1$ (mod $3$), and by I.H. $T_n\equiv 0$ (mod $3$). By triangle number definition, $T_{n+1} = T_n + n + 1 \equiv 1$ (mod $3$), as required.

  • If $n \equiv 2$ (mod $3$), then $n+1 \equiv 0$ (mod $3$), and by I.H. $T_n\equiv 0$ (mod $3$). By triangle number definition, $T_{n+1} = T_n + n + 1 \equiv 0$ (mod $3$), as required.

Colm Bhandal
  • 4,649