Sorry for being out for so long! Anyhow, let’s just jump right in. I want to dedicate this post to a very special sequence.

Problem:Find the closed form (that is, a formula for determining the th term) of the sequence , where each integer repeats times.

**Motivation for Writing Post:**

This sequence has a bit of history with me which I want to quickly gloss over, although feel free to skim/skip this of course:

I had first encountered this sequence my junior year of high school online (Twitter, I believe, during the whole two weeks I used Twitter). I had followed someone who posted math problems everyday and one day he posted: “Find the formula for the *n*th term of 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, …” It immediately caught my eye and I started to attempt it… and got nowhere after working for a good hour or so straight. I left it for a bit to clear my mind then came back and suddenly had an epiphany and saw the pattern hidden in plain sight — and from there it was straight forward!

Two years later in my freshman year of college I was in a Discrete Structures course covering sequences and series and my professor had written up multiple different lists of elements on the board asking students to find the closed form of each sequence. Lo and behold, there it was! Of course, I couldn’t remember the formula off the top of my head and I recalled it taking a good few minutes to find the answer, so I just left that blank (this wasn’t an assignment, just the professor sort of testing us mid-lecture). Afterwards, he went through each sequence and showed us its closed form, and when he got to the infamous 1, 2, 2, 3, 3, 3, … he asked around if anyone found its formula and no one responded and I just smiled at him (I thought he must be playing off of how surely no one calculated it in time). To my surprised, he then went and said “You actually can’t find the formula for this one because it doesn’t exist! All you can say is each integer *m* repeats *m* times.” This really bothered me, and I actually approached him at the end of class telling him that such a formula exists and showed him the pattern embedded in the sequence — then that very night over email I discussed the actual derivation of the closed form with him. 🙂

Besides this though, I’ve met a good handful of people who didn’t believe me when I said this sequence has a closed form. I’ve always wanted to write this just to show where the pattern in this series is and how to use to your advantage.

**Solution:
**Let’s begin by writing out the sequence a bit so we can closely examine it.

Something seems to be going on with the subscripts of … Look where terms stop repeating, 1 stops at 1, 2 at 3, 3 at 6… Putting where they stop in sort of their own little sequence , we have . Maybe you’ve encountered this before — is actually a sequence of what’s known as triangular numbers! That is, you get each number by summing up natural numbers, like this:

There’s our hidden pattern, exactly what we needed. Giving us the following:

Lemma:If , then we have

**Proof: **Since repeats times and we start with , we then have as the final term of 2, as the final term of 3, and in general as the final term of . This justifies that if then . For the other side of the inequality, note that if then *stopped repeating* at , so beginning *after* this term is where begins repetition. This concludes the proof.

It practically follows as corollary what we do next. Using the inequality from our lemma, we now just proceed with some algebraic manipulation:

Note, the is added in order to factor in the next step.

Lastly, we’re going to take the ceiling function of everything, giving

providing us our final answer of…

The sequence , where repeats times, has the closed form

.

The ceiling function ( means always round up to the nearest integer) was added because was *between *the two integers and , and it is capable of only being an integer and is undefined for , so it must be rounded up to .

This wasn’t necessarily a one-glance proof and it may require some rereading to really understand the gist of everything, so please do reread it (I mean for goodness sake, it took me hours the first time to get this, and now I’m just throwing it all at you at once).

This problem always makes me think back to a quote I heard in a Numberphile video many months ago that managed to always stick with me, and I hope, perhaps after seeing this post, that it’ll stick with you as well.

“If you know something, prove it! Make sure you really understand that one thing and that often unlocks the rest.” — Daniel Erman, The Josephus Problem