Post History
Given an positive integer $n$, return the least positive integer $k$ such that the $k$th partial sum of the harmonic series is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, b...
Question
code-golf
#3: Post edited
Partial Sums of Harmonic Series
- Given an positive integer $n$, return the least positive integer $k$ such that the $k$th partial sum of the [harmonic series](https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)) is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, because $1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} = \frac{25}{12} > 2$.
- # More Input/Output Examples
- ```
- Input -> Output
- 1 -> 1
- 3 -> 11
- 4 -> 31
- ```
This is code-golf, so shortest code wins.
- Given an positive integer $n$, return the least positive integer $k$ such that the $k$th partial sum of the [harmonic series](https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)) is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, because $1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} = \frac{25}{12} > 2$.
- # More Input/Output Examples
- ```
- Input -> Output
- 1 -> 1
- 3 -> 11
- 4 -> 31
- ```
- This is <a class="badge is-tag">code-golf</a>, so shortest code wins.
#2: Post edited
Given an positive integer $n$, return an integer $k$ such that the $k$th partial sum of the [harmonic series](https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)) is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, because $1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} = \frac{25}{12} > 2$.- # More Input/Output Examples
- ```
- Input -> Output
- 1 -> 1
- 3 -> 11
- 4 -> 31
- ```
- This is code-golf, so shortest code wins.
- Given an positive integer $n$, return the least positive integer $k$ such that the $k$th partial sum of the [harmonic series](https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)) is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, because $1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} = \frac{25}{12} > 2$.
- # More Input/Output Examples
- ```
- Input -> Output
- 1 -> 1
- 3 -> 11
- 4 -> 31
- ```
- This is code-golf, so shortest code wins.
#1: Initial revision
Partial Sums of Harmonic Series
Given an positive integer $n$, return an integer $k$ such that the $k$th partial sum of the [harmonic series](https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)) is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, because $1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} = \frac{25}{12} > 2$. # More Input/Output Examples ``` Input -> Output 1 -> 1 3 -> 11 4 -> 31 ``` This is code-golf, so shortest code wins.