#P8749. First Occurrence in Pascal's Triangle Sequence
First Occurrence in Pascal's Triangle Sequence
First Occurrence in Pascal's Triangle Sequence
The famous Pascal's Triangle is arranged as follows:
If we list all the numbers of the triangle in order from top to bottom and from left to right, we obtain the sequence:
$1,1,1,1,2,1,1,3,3,1,1,4,6,4,1,\ldots$
Given a positive integer $N$, find the 1-indexed position where $N$ appears for the first time in this sequence.
inputFormat
The input consists of a single line containing a positive integer $N$.
outputFormat
Output a single integer, which is the 1-indexed position of the first occurrence of $N$ in the sequence formed by reading the Pascal's Triangle row by row from left to right.
sample
1
1