# Deriving a formula for an arbitrary term in $1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, \ldots$

A sequence of numbers is given as: $$1, 2, 2, 3, 3, 3, 4, 4, 4, 4, \text{and so on}$$ (Each integer $$n$$ is repeated $$n$$ times.) What will be the 50th term of that sequence?

Let's say $$x=50$$. Then solving $$x=n(n+1)/2$$ gives the value of $$n$$ (rounded off to nearest integer).

My question is: If I make a small change in the above pattern, can we have a direct formula to calculate $$n$$?

The new pattern is : $$1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, \ldots$$ i.e., $$1$$ and $$2$$ are repeated once, and $$n$$ is repeated $$(n-1)$$ times.

How can we derive a formula for this pattern?

• You can ignore the existence of the $1$, and then notice that the sequence $2,3,3,4,4,4,5,5,5,5,\dots$ is simply the sequence where each entry is one more than the corresponding entry in the earlier mentioned sequence. – JMoravitz Jan 30 at 19:25
• Yeah i get that, but let's say i'm only provided with 'x' and i need to find the corresponding 'n' for it according to the new sequence – Maxy Daen Jan 30 at 19:31

## 1 Answer

Using JMoravitz hint above, you can replace $$x$$ with $$x-1$$ and $$n$$ with $$n-1$$ and now your formula is $$x-1=(n-1)(n)/2$$. Whatever you get for n should be rounded up to the nearest integer if it isn't an integer already.

For example for $$x=5$$, we have $$4 = (n-1)(n)/2 \to 8 = (n-1)(n) \to n^2-n-8=0 \to n=3.37$$ which rounds up to 4.

• Ultimately this amounts to the formula $$n = \left \lceil \frac 12 (\sqrt{8x - 7} + 1) \right \rceil$$ – Omnomnomnom Jan 30 at 19:59
{"ft_lang_label":"__label__en","ft_lang_prob":0.8569726,"math_prob":0.9999856,"size":581,"snap":"2019-35-2019-39","text_gpt3_token_len":225,"char_repetition_ratio":0.13691507,"word_repetition_ratio":0.01754386,"special_character_ratio":0.41135973,"punctuation_ratio":0.24698795,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99997604,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-08-21T15:32:39Z\",\"WARC-Record-ID\":\"<urn:uuid:dcf4db99-ebd4-4bcc-a031-504765673a3e>\",\"Content-Length\":\"137167\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:1d536c2d-915d-460e-a04f-65c22dc4afef>\",\"WARC-Concurrent-To\":\"<urn:uuid:0ed3f3eb-5eaf-49ab-b802-a79b57a6d6f1>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://math.stackexchange.com/questions/3093987/deriving-a-formula-for-an-arbitrary-term-in-1-2-3-3-4-4-4-5-5-5-5-6\",\"WARC-Payload-Digest\":\"sha1:BIWD5ZMO6BRZ622YWSQQ5T6FUQGMQMOD\",\"WARC-Block-Digest\":\"sha1:DKK7U7WD3QFQYVFQXQWT3OSI5WV55LRL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-35/CC-MAIN-2019-35_segments_1566027316075.15_warc_CC-MAIN-20190821152344-20190821174344-00279.warc.gz\"}"}