Help deriving sequence definition from pattern Below are the first 21 elements $a_{1}, a_{2}, \ldots a_{21}$ of a sequence. Although the pattern is quite apparent, I have tried many strategies for writing a general definition $a_n$, including recursion and subsequences, but with no luck. 
$\{a_1,a_2,\ldots, a_{21}\} = \{1,1,1,1,1,2,1,1,2,4,1,1,2,4,8,1,1,2,4,8,16\}$
I apologize if this sequence has a well known definition or if this question has been asked previously. Any pointers or tips for understanding the sequence would be greatly appreciated. 
 A: Warning: Largely a partial answer
I at least have one possible description/source of the sequence per the OEIS. They give a semicomplete description of the sequence in question, but what eludes me for the time being is how to find a generic term of the sequence. But there is a description at least of where this sequence can come from.

Based on a search result in the OEIS (sequence $A232089$), it comes in effect from creating a table of powers of $2$. When left-justified, it has a right triangle shape.


*

*You make the first column always have one

*The $n^{th}$ row has $n$ items

*In the columns after the initial $1$, you have ascending powers of $2$, starting with $2^0$ and going up by one each time, until you exhaust the number of elements you're allowed. As a result, the last element of a given row will be $2^{(\text{row #}) - 2}$
An example in how you could create this table (as noted on the OEIS page):


*

*Row $\#1 \implies$ $1,$

*Row $\#2 \implies$ $1, 1,$

*Row $\#3 \implies$ $1, 1, 2,$

*Row $\#4 \implies$ $1, 1, 2, 4,$

*Row $\#5 \implies$ $1, 1, 2, 4, 8,$

*Row $\#6 \implies$ $1, 1, 2, 4, 8, 16,$

*Row $\#7 \implies$ $1, 1, 2, 4, 8, 16, 32,$

*Row $\#8 \implies$ $1, 1, 2, 4, 8, 16, 32, 64,$
The sequence you have will then be created by reading these numbers in successive order from the table.
An explicit formula doesn't seem exactly useful - feels like it would rely on a lot of various cases - but it can probably be done. Let $n$ be the row number, and say you want the $k^{th}$ entry in said row (where $k\in[0,n] \cap \Bbb Z$). Then you have
$$T(n,k) = \max\{1,2^{k-1}\}$$
Not sure how one could generalize this to the $i^{th}$ entry of your sequence, i.e. if you wanted $a_{123451}$ or whatever, though.
A: First define
$$\large{b_n = \left\lfloor\sqrt{2 n -1.75}-0.5\right\rfloor.}$$
Then
$$\large{a_n=\left\lceil 2^{n-2-\frac{b_n (b_n+1)} 2} \right\rceil.}$$
This works because $b_n$ is the number of triangular numbers less than $n$ (starting with $1$ as the first triangular number).
You could probably work on these formulas to make them more attractive.
