Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first 5
rows (borrowed from Generate Pascal's triangle):
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . .
Collapse these rows to the left
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . .
Sort them in ascending order
1
1 1
1 1 2
1 1 3 3
1 1 4 4 6
. . .
Read this triangle by rows
[1, 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 4, 6 ...]
Given an input n
, output the n
th number in this series. This is OEIS 107430.
Rules
- You can choose either 0- or 1-based indexing. Please state which in your submission.
- The input and output can be assumed to fit in your language's native integer type.
- The input and output can be given by any convenient method.
- Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.