#P8676. Golomb Sequence
Golomb Sequence
Golomb Sequence
The Golomb Sequence is a self-descriptive sequence denoted by \(G(n)\) with two interesting properties:
- For every positive integer \(n\), the number \(n\) appears exactly \(G(n)\) times in the sequence.
- The sequence is non-decreasing.
For example, the first several values are given in the table below:
n | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
\(G(n)\) | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 4 | 5 | 5 | 5 | 6 | 6 |
Given an integer \(n\), compute \(G(n)\).
inputFormat
The input consists of a single integer \(n\) on one line.
outputFormat
Output the value of \(G(n)\) for the given input \(n\).
sample
1
1
</p>