Periodicity of $\frac{1}{x}-\frac{1}{\frac{3}{x}-\frac{1}{\frac{5}{x}-\frac{1}{\cdots}}}$ and others
The function $$f(x)=\frac{\color{blue}{1}}{x}-\frac{1}{\frac{\color{blue}{3}}{x}-\frac{1}{\frac{\color{blue}{5}}{x}-\frac{1}{\cdots}}}$$ is periodic with minimal period $\pi$.
But what if we replace the arithmetic sequence $(\color{blue}{1},\color{blue}{3},\color{blue}{5},\ldots)$ by another one?
Neither $$g(x)=\frac{\color{blue}{2}}{x}-\frac{1}{\frac{\color{blue}{4}}{x}-\frac{1}{\frac{\color{blue}{6}}{x}-\frac{1}{\cdots}}},$$ nor $$h(x)=\frac{\color{blue}{1}}{x}-\frac{1}{\frac{\color{blue}{2}}{x}-\frac{1}{\frac{\color{blue}{3}}{x}-\frac{1}{\cdots}}}$$ seem to be periodic.
In fact, I tried the arithmetic sequences $(3n+1)_{n=0}^\infty$, $(4n+1)_{n=0}^\infty$, $(4n+3)_{n=0}^\infty$, $(5n+1)_{n=0}^\infty$, with no apparent success: none of them seems to generate a non-constant periodic function here.
Is it true that, out of all positive integer arithmetic sequences, only $(2n+1)_{n=0}^\infty$ generates a non-constant periodic function in this context? If so, why?
Remark: $f$ is actually the cotangent function; see https://functions.wolfram.com/ElementaryFunctions/Tan/10/0003/.
The standard reference for continued fractions (at least as of 100 years ago) is
Perron, Oskar, Die Lehre von den Kettenbrüchen. Leipzig—Berlin: B. G. Teubner. xiii, 520 S. $(8^\circ)$ (1913). ZBL43.0283.04.
Section 81, Satz 3 states (in modern language): Consider the continued fraction $$ b_0 + \frac{a_1}{b_1 + \displaystyle\frac{a_2}{b_2+\ddots}} $$ with $a_n = a$ and $b_n = dn+c$. Provided $a \ne 0, c \ne 0,$ and $d \ne 0$, the value of the continued fraction is $$ V = \frac{c \; {}_0F_1(;c/d;a/d^2)}{\;{}_0F_1(;1+c/d;a/d^2)\;} $$
Using this, we get:
$$ f(x) = \cot(x) $$ which is periodic;
$$ g(x) = \frac{J_0(x)}{J_1(x)} $$ in terms of Bessel functions, which is not periodic, and
$$ h(x) = \frac{J_0(2x)}{J_1(2x)} $$ which is not periodic.