Given a strictly positive integer n, follow these steps:
- Create an array A with n 1s.
- If A only has one element, terminate. Otherwise, starting from the first element, replace each pair of A with its sum, leaving the last element as is if A's length is odd, and repeat this step.
The output should contain A's state after each step in order from the first step to the last. Usage of standard loopholes is forbidden. This is a code-golf challenge, so the solution with the fewest bytes in each language wins.
Test cases
Each line in the output of these examples is a state. You can output via any reasonable format.
Input: 1
[1]
Input: 4
[1, 1, 1, 1]
[2, 2]
[4]
Input: 13
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[2, 2, 2, 2, 2, 2, 1]
[4, 4, 4, 1]
[8, 5]
[13]
Input: 15
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[2, 2, 2, 2, 2, 2, 2, 1]
[4, 4, 4, 3]
[8, 7]
[15]