# primes generated by a continued fraction

On the post Is there an explanation for the behaviour of this finite continued fraction in connection with prime numbers? I asked this question in a non-generalized form focusing only on the $4th$ partial convergent but now generalizing the problem and clarifying it ,we have

Given the continued fraction which satisfies the property proposed in one of my old posts

$G(q)=\cfrac{1}{1-q+\cfrac{q(1-q)^2}{1-q^3+\cfrac{q(1-q^2)^2}{1-q^5+\cfrac{q(1-q^3)^2}{1-q^7+\cfrac{q(1-q^4)^2}{1-q^9+\dots}}}}}$

and $kth$ partial convergent of the continued fraction

$\cfrac{1}{1-q+\cfrac{q(1-q)^2}{1-q^3+\cfrac{q(1-q^2)^2}{1-q^5+\cfrac{q(1-q^3)^2}{\ddots+\cfrac{q(1-q^k)^2}{1-q^{2k+1}}}}}}=\exp\Big(\sum_{n=2}^{\infty} (-1)^n\phi_{k}(n)\,q^n\Big)$

where $|q|\lt\frac{1}{4}$,and $\phi_{k}(n)$ is our symbol of choice that represents coefficients of the series(please note that it doesn't represent any standard function) depending on the $kth$ partial convergent $k\gt2$.

For $k\gt2$,every partial convergent of the continued fraction seems to have the property that:

For all values of $n$ but a few(that are exceptions to the rule) ,$\phi_{k}(n)$ is integer when $n$ is prime and non-integer when $n$ is composite.

For example on the $7th$ partial convergent of the continued fraction,there's only one exception $n=15$ in $1\lt n\lt200$

Formally we may call $\phi_{k}(n)$ an arithmetic function which returns an integer when $n$ is a prime number and non-integer when $n$ is a composite number for all natural numbers $n$ but a few for $k\gt2$.

So the question is

Why is $\phi_{k}(n)$ integer when $n$ is prime and non-integer when it is composite for all values of $n$ but a few for $k\gt2$?

We may be led to conjecture that whenever $n=prime$,the arithmetic function $\phi_{k}(n)$ is always integer.

• Perhaps a case of the "law of small numbers". Extend the search in order to see whether this is the case. Aug 9, 2017 at 14:19
• It would help to write it as a sequence of $q$-series and see what are their coefficients Aug 12, 2017 at 8:04
• @reuns:I have tried it already ,but unfortunately the OEIS doesn't seem to recognize it.Moreover the radius of convergence for q-series is the unit circle $|q|\lt1$ ,while for this particular series is $|q|\lt\frac{1}{4}$ Aug 12, 2017 at 8:13
• Did you find an induction rule for the (coefficients of) the sequence of $q$-series ? Aug 12, 2017 at 8:17

Take any power series on the form $F(q)=1+a_2q^2+a_3q^3+\cdots$ with integer coefficients: ie, the constant term is $1$ and the linear term is zero, otherwise it is a general power series. Your $G(q)$ takes this form, as do the $k$th partial convergents.
Next, rewrite $F(q)$ on the form $$F(q)=\prod_{k=2}^{\infty}(1+\alpha_k q^k)=(1+\alpha_2 q^2)(1+\alpha_3 q^3)\cdots$$ which can always be done and gives $\alpha_i\in\mathbb{Z}$.
Now, for $F(q)=\exp f(q)$, you ask why $f(q)=f_1q+f_2q^2+\cdots$ gives integer coefficients for $f_n$ whenever $n$ is a prime, but not when $n$ is composite.
To see why, write $f(q)=\ln F(q)$ and take the power expansion $$f(q) = \ln F(q) = \sum_{k=2}^\infty \ln(1+\alpha_k q^k) = \sum_{k=2}^\infty \sum_{i=1}^\infty (-1)^{i-1}\frac{\alpha_k^i q^{ki}}{i}.$$ Contributions to the coefficient of $q^n$ come from pairs $(k,i)$ where $ki=n$. If $n$ is prime, then $k=n$ and $i=1$: the opposite, $k=1$ and $i=n$, does not contribute as $k\ge2$ (or, equivalently, the coefficient $\alpha_1=0$). When $k=n$ and $i=1$ is the only contributing term to the coefficient of $q^n$, the coefficient $f_n=\alpha_n$.
When $n$ is not prime, there may be terms contributing to the coefficient of $q^n$ where $i>1$ and which may therefore be non-integral.