# Fill in the next numbers [tag:code-golf] [tag:array] [tag:number] Given a list of integers, output a list where the \$ i \$th element of the list equals the first number in the input list which is \$ \ge i \$, until there are no such numbers. For example, if the input is the first 5 prime numbers: ``` 2 3 5 7 11 ``` then we "expand" the sequence out to show where the gaps are: ``` 2 3 5 7 11 # primes 1 4 6 8 9 10 # gaps ``` Now we fill in the blanks with the next number that is in the sequence in each case: ``` 2 2 3 5 5 7 7 11 11 11 11 1 4 6 8 9 10 ``` This is our output. ## Test cases ``` [1] -> [1] [3] -> [1, 2, 3] [1, 2, 3] -> [1, 2, 3] [2, 3, 5, 7, 11] -> [2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11] ``` ## Rules - You may assume the input list is non-empty, strictly increasing, and only contains positive integers - You may use any [standard I/O method](https://codegolf.meta.stackexchange.com/q/2447) - [Standard loopholes](https://codegolf.meta.stackexchange.com/q/1061) are forbidden - This is [tag:code-golf], so the shortest code in bytes wins --- # Meta - Better title? - Is this a duplicate? - Probably - Is this clear enough? - Any other feedback?