# [Julia 1.0], <s>27</s> 24 bytes

<!-- language-all: lang-julia -->

    >(x,i=1)=1+(0<x-1/i>i+1)

[Try it online!][TIO-kqf1c5yd]

[Julia 1.0]: http://julialang.org/
[TIO-kqf1c5yd]: https://tio.run/##DchBCoAgEAXQ6zg0Tf5U2qQXiRYtJ0QiCrz91Fu@8616oJsV11kzKGNwfu0jJi06gOy6tT21iZPiNkjimQMHQUTiyImXv@B3IvsA "Julia 1.0 – Try It Online"

-3 bytes thanks to [H.PWiz](https://codegolf.stackexchange.com/users/71256/h-pwiz)

the same approach as [xnor](https://codegolf.stackexchange.com/a/199201/98541)