Is there any similar solutions including $\pi$ like $1-\frac{1}{2}+\frac{1}{4}-\frac{1}{5}+\cdots=\frac{\pi}{3\sqrt{3}}$?

Your first examples are $L$-series of quadratic Dirichlet characters. If $\chi$ is a primitive Dirichlet character of conductor $N$ taking values in $\{\pm1\}$ and with $\chi(-1)=-1$ then $$\zeta(s)L(s,\chi)=\zeta_K(s)$$ where $K=\Bbb Q(\sqrt{-N})$ and $\zeta_K$ is the Dedekind zeta function of $K$. The analytic class number gives $$L(1,\chi)=\frac{2\pi h}{w\sqrt{N}}$$ where $h$ is the classnumber of $K$ and $w$ the number of roots of unity in $K$.

For such $\chi$, one can obtain closed formulae for $L(m,\chi)$ whenever $m$ is a positive odd number. One way to so this is to use the functional equation for the L-functions, to relate it to $L(1-m,\chi)$ which can be evaluated in terms of generalised Bernoulli numbers. (See Washington's Introduction to Cyclotomic Fields).


I was going to write more or less the same answer of Lord Shark, so let us steer in a more elementary direction. The fact that Gregory series equals $\frac{\pi}{4}$ can be seen as a consequence of

$$ \sum_{n\geq 0}\frac{(-1)^n}{2n+1}=\int_{0}^{1}\sum_{n\geq 0}(-1)^n x^{2n}\,dx = \int_{0}^{1}\frac{dx}{1+x^2}=\arctan(1)=\frac{\pi}{4}\tag{A}$$ but since $$ \int_{0}^{+\infty}\frac{dx}{1+x^k} = \frac{\pi}{k\sin\frac{\pi}{k}}\tag{B}$$ from Euler's Beta function and the reflection formula for the $\Gamma$ function, a lot of similar identities can be simply derived from $(B)$ by reverse engineering. For instance, by taking $k=5$, $$ \frac{\pi}{5\sin\frac{\pi}{5}}=\int_{0}^{1}\frac{1+x^3}{1+x^5}\,dx =\sum_{n\geq 0}(-1)^n\left(\frac{1}{5n+1}+\frac{1}{5n+4}\right)\tag{C}$$ and by taking $k=12$: $$ \sum_{n\geq 0}(-1)^n\left(\frac{1}{12n+1}+\frac{1}{12n+11}\right)=\frac{\pi}{3\sqrt{2}(\sqrt{3}-1)}.\tag{D} $$


I am very grateful to Jack D'Aurizio and Lord Shark the Unknown for their answers, but I find a pretty simple (for me to understanding) solution and want to share it. What is also interesting with it, that it gives results not only for odd, but to even degrees too.

As we know from Claude Leibovici answer,

$$Z(a,b,k)=\sum\limits_{n=0}^{\infty}\frac{1}{(a+nb)^k}=\frac{(-1)^k}{(k-1)!b^k}\psi^{(k-1)}\left(\frac{a}{b}\right)$$

so let $k=1$, then

$$Z(a,b,1)=\sum\limits_{n=0}^{\infty}\frac{1}{(a+nb)}=-\frac{1}{b}\psi^{(0)}\left(\frac{a}{b}\right)$$

Next we need to know about this pretty equation:

$$\psi^{(0)}(1-z)-\psi^{(0)}(z)=\pi\cot(\pi z)$$

Considering them together, we have to coprime with $3$:

$$f_{1}(3,I[+])=1-\frac{1}{2}+\frac{1}{4}-\frac{1}{5}+\cdots=\sum\limits_{n=0}^{\infty}\left[\frac{1}{(1+3n)}-\frac{1}{(2+3n)}\right]=$$

$$-\frac{1}{3}\left[\psi^{(0)}\left(\frac{1}{3}\right)-\psi^{(0)}\left(\frac{2}{3}\right)\right]=\frac{\pi}{3}\cot\left(\frac{\pi}{3}\right)=\frac{\pi}{3\sqrt{3}}$$

and to coprime with $5$:

$$f_{1}(5,I[+])=1-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}+\cdots=\sum\limits_{n=0}^{\infty}\left[\frac{1}{(1+5n)}-\frac{1}{(2+3n)}+\frac{1}{(3+5n)}-\frac{1}{(4+5n)}\right]=$$

$$-\frac{1}{5}\left[\psi^{(0)}\left(\frac{1}{5}\right)-\psi^{(0)}\left(\frac{4}{5}\right)-\left(\psi^{(0)}\left(\frac{2}{5}\right)-\psi^{(0)}\left(\frac{3}{5}\right)\right)\right]=\frac{\pi}{5}\left[\cot\left(\frac{\pi}{5}\right)-\cot\left(\frac{2\pi}{5}\right)\right]=N$$

As we know,

$$\cot\left(\frac{\pi}{5}\right)=\sqrt{\frac{\sqrt{5}+2}{\sqrt{5}}}, \cot\left(\frac{2\pi}{5}\right)=\sqrt{\frac{\sqrt{5}-2}{\sqrt{5}}}, N=\frac{\pi(\sqrt{\sqrt{5}+2}-\sqrt{\sqrt{5}-2})}{5^{5/4}}$$

then

$$\left(\sqrt{\sqrt{5}+2}-\sqrt{\sqrt{5}-2}\right)^2=\sqrt{5}+2-2\sqrt{5-4}+\sqrt{5}-2=2(\sqrt{5}-1)$$

and finally we have:

$$\frac{\sqrt{5}-1}{2}=\frac{1}{\varphi}, \sqrt{2(\sqrt{5}-1)}=\sqrt{\frac{4}{\varphi}}=\frac{2}{\sqrt{\varphi}}, \color{red}{N=\frac{2}{5^{5/4}}\cdot\frac{\pi}{\sqrt{\varphi}}}$$

Now let $k=2$, then

$$Z(a,b,2)=\sum\limits_{n=0}^{\infty}\frac{1}{(a+nb)^2}=\frac{1}{b^2}\psi^{(1)}\left(\frac{a}{b}\right)$$

and second pretty equation is

$$\psi^{(1)}(1-z)+\psi^{(1)}(z)=\frac{\pi^2}{\sin^2(\pi z)}$$

Considering them together, we have to coprime with $3$:

$$f_{2}(3,R[+-])=1-\frac{1}{2^2}-\frac{1}{4^2}+\frac{1}{5^2}+\cdots=\sum\limits_{n=0}^{\infty}\left[\frac{1}{(1+6n)^2}-\frac{1}{(2+6n)^2}-\frac{1}{(4+6n)^2}+\frac{1}{(5+6n)^2}\right]=$$

$$\frac{1}{36}\left[\psi^{(1)}\left(\frac{1}{6}\right)+\psi^{(1)}\left(\frac{5}{6}\right)-\left(\psi^{(1)}\left(\frac{1}{3}\right)+\psi^{(1)}\left(\frac{2}{3}\right)\right)\right]=\frac{\pi^2}{36}\left[\frac{1}{\sin^2\left(\frac{\pi}{6}\right)}-\frac{1}{\sin^2\left(\frac{\pi}{3}\right)}\right]=\frac{2\pi^2}{27}$$

and to coprime with $5$:

$$f_{2}(5,R[+-])=1-\frac{1}{2^2}-\frac{1}{3^2}+\frac{1}{4^2}+\cdots=\sum\limits_{n=0}^{\infty}\left[\frac{1}{(1+5n)^2}-\frac{1}{(2+5n)^2}-\frac{1}{(3+5n)^2}+\frac{1}{(4+5n)^2}\right]=$$

$$\frac{1}{25}\left[\psi^{(1)}\left(\frac{1}{5}\right)+\psi^{(1)}\left(\frac{4}{5}\right)-\left(\psi^{(1)}\left(\frac{2}{5}\right)+\psi^{(1)}\left(\frac{3}{5}\right)\right)\right]=\frac{\pi^2}{25}\left[\frac{1}{\sin^2\left(\frac{\pi}{5}\right)}-\frac{1}{\sin^2\left(\frac{2\pi}{5}\right)}\right]=\frac{4\pi^2}{25\sqrt{5}}$$

It's a little incorrect, that I not introduce some correction to $f_{k}(m)$ (function, which about I was wrote in my question). So here it is:

  1. As you already have managed to notice, $s_{m}(r)+s_{m}(a\varphi(m)-r+1)=am$ (here $s_{m}(r)$ - function from my question, which generates $r$-th coprime with $m$, $\varphi(m)$ - Euler totient function, $|\mu(m)|=1$, $r<a$).

  2. When $k=1$, we need to have two digamma functions with different signs, whose sum of values (not results) gives us $1$: $$\psi^{(0)}\left(\frac{s_{m}(r)}{am}\right)-\psi^{(0)}\left(\frac{s_{m}(a\varphi(m)-r+1) }{am}\right)$$

  3. We can have it only if sign-alternating cycle (one green and one blue) is inverse concerning the center (position between green and blue), which we can write as $f_{k}(m, I[\cdots])$. For example:

$$f_{1}(5, I[++])=\color{green}{+1+\frac{1}{2}}\color{blue}{-\frac{1}{3}-\frac{1}{4}}\color{green}{+\frac{1}{6}+\frac{1}{7}}\color{blue}{-\frac{1}{8}-\frac{1}{9}}+\cdots$$

$$f_{1}(3, I[++-])=\color{green}{+1+\frac{1}{2}-\frac{1}{4}}\color{blue}{+\frac{1}{5}-\frac{1}{7}-\frac{1}{8}}\color{green}{+\frac{1}{10}+\frac{1}{11}-}\cdots$$

$$f_{1}(30, I[+-++])=\color{green}{+1-\frac{1}{7}+\frac{1}{11}+\frac{1}{13}}\color{blue}{-\frac{1}{17}-\frac{1}{19}+\frac{1}{23}-\frac{1}{29}}+\cdots$$

  1. Similar rule for trigamma functions, which pairs must have same terms, and whose sign-alternating cycle is reflecting concerning the center, for example:

$$f_{1}(5, R[+-])=\color{green}{+1-\frac{1}{2}}\color{blue}{-\frac{1}{3}+\frac{1}{4}}\color{green}{+\frac{1}{6}-\frac{1}{7}}\color{blue}{-\frac{1}{8}+\frac{1}{9}}+\cdots$$

$$f_{1}(3, R[++-])=\color{green}{+1+\frac{1}{2}-\frac{1}{4}}\color{blue}{-\frac{1}{5}+\frac{1}{7}+\frac{1}{8}}\color{green}{+\frac{1}{10}+\frac{1}{11}-}\cdots$$

$$f_{1}(30, R[+-++])=\color{green}{+1-\frac{1}{7}+\frac{1}{11}+\frac{1}{13}}\color{blue}{+\frac{1}{17}+\frac{1}{19}-\frac{1}{23}+\frac{1}{29}}+\cdots$$

Pretty equations with digamma and trigamma functions can be generalized as

$$(-1)^{n}\psi^{(n)}(1-z)-\psi^{(n)}(z)=\pi\frac{d^n}{dz^n}\cot(\pi z)=\pi^{n+1}\frac{P_{n}(\cos(\pi z))}{\sin^{n+1}(\pi z)}$$

where

$$P_{0}(x)=x, P_{n+1}(x)=-\left[x(n+1)P_{n}(x)+(1-x^2)P'_{n}(x)\right]$$

So as you can see, we can find result for odd degrees ($k$), if sign-alternating cycle is inverse concerning the center and for even, if it reflecting. Also for final generalization we need to make another little corrections:

  1. In the second example, when $k=2$, values of trigamma function is $\frac{s_{3}(r)}{6}$. Why there is $6$ in denominator, not $3$? Because length of sign-alternating cycle is bigger, than $\varphi(m)$, so we need create some new parameters.

  2. $L$ - length of sign-alternating cycle (double quantity of signs in $[\cdots]$ after $I$ or $R$).

  3. $Q=\frac{\varphi(m)L}{\gcd(\varphi(m),L)}$ - LCM of $(\varphi(m),L)$.

  4. $M=\frac{mQ}{\varphi(m)}=\frac{mL}{\gcd(\varphi(m),L)}$ - corrected denominator of polygamma function values (not results).

  5. $W(r)$ - function, which takes values of $1$ and $-1$ because of terms of sign-alternating cycle. For example:

$$f_{1}(3, I[++-])=\color{green}{+1+\frac{1}{2}-\frac{1}{4}}\color{blue}{+\frac{1}{5}-\frac{1}{7}-\frac{1}{8}}\color{green}{+\frac{1}{10}+\frac{1}{11}-}\cdots$$

$$\color{green}{W(1+6n)=1, W(2+6n)=1, W(3+6n)=-1}$$

$$\color{blue}{W(4+6n)=1, W(5+6n)=-1, W(6n)=-1}$$

Now we can make a generalization:

$$f_{k}(m,\cdots)=\sum\limits_{i=0}^{\infty}\left[\sum\limits_{r=1}^{Q}W(r)\left(\frac{1}{s_{m}(r)+Mi}\right)^k\right]=\sum\limits_{r=1}^{Q}W(r)Z(s_{m}(r),M,k)$$

Here instead of $\cdots$ we can write $I[\cdots]$ for odd degrees and $R[\cdots]$ for even. So finally we have:

$$\color{red}{f_{k}(m,\cdots)=\frac{1}{(k-1)!}\left(\frac{\pi}{M}\right)^k\sum\limits_{r=1}^{Q/2}W(r)\frac{P_{k-1}\left(\cos\left[\frac{\pi}{M}\cdot s_{m}(r)\right]\right)}{\sin^k\left[\frac{\pi}{M}\cdot s_{m}(r)\right]}}$$

If I made some mistakes, sorry for my English.