Comments on Partial Sums of Harmonic Series
Parent
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 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.
Japt, 11 10 bytes >0©Òß …
3y ago
[Python 3], 35 bytes …
4y ago
AppleScript, 178 bytes ``` …
4y ago
[Raku], 27 bytes {+ …
4y ago
[Scala], 55 bytes ( …
3y ago
Stax, 9 bytes Ç≈f♠É↔X+ö …
4y ago
[JavaScript (Node.js)], 47 byt …
4y ago
[Jelly], 8 bytes İ€S<¬ʋ …
3y ago
[J], 23 bytes >:@]^:(>1 …
3y ago
JavaScript, 29 bytes …
3y ago
Goruby, 38 bytes ``` ->n{dw{ …
2y ago
0 comment threads