How to calculate $ \lim_{n\to \infty}\left(\sum_{k=1}^{n}\frac{1}{3k+1}-\frac{\ln n}{3}\right)$ When I learned harmonic series. I met this limit.
$\displaystyle \lim_{n\to \infty}\left(\sum_{k=0}^{n}\frac{1}{3k+1}-\frac{\ln n}{3}\right)=\frac{\gamma}{3}+\frac{\sqrt3\pi}{18}+\frac{\ln3}{2}$
$\gamma$ is EulerGamma.
But i don't know how to prove it.And naturally i got:
$\displaystyle \lim_{n\to \infty}\left(\sum_{k=0}^{n}\frac{1}{pk+1}-\frac{\ln n}{p}\right)\qquad p\in N$    
Could someone help me to solve the two limits?
 A: We take a closer look at the expression:
$$
\sum_{k=0}^{n}\frac{1}{3k+1}-\frac{\ln(n)}{3}\approx\frac13\left(\sum_{k=0}^{n}\frac{1}{k+\frac13}-H_{n+1}\right)+\frac13\left(H_{n+1}-\ln(n)\right)\approx\sum_{k=0}^{n}\left(\frac{1}{k+\frac13}-\frac{1}{k+1}\right)+\frac\gamma 3
$$
Now we have for the digamma function:
$$
\psi(x)=-\gamma+\sum_{k=0}^{\infty}\frac{1}{k+1}-\frac{1}{k+x}
$$
So the limit evaluates at:
$$
\lim_{n\to\infty}\sum_{k=0}^{n}\left(\frac{1}{k+\frac13}-\frac{1}{k+1}\right)+\frac\gamma 3=-\psi(\frac{1}{3})-\frac{2}{3}\gamma
$$
For $\psi(\frac{1}{3})$ we use $\psi(1-x)-\psi(x)=\pi\cot(\pi x)$ and $\psi(x)+\psi(x+\frac13)+\psi(x+\frac23)=3\psi(3x)-3\ln(3)$ which can be proven by taking the derivative of the reflection and multiplication formula of the gamma function. At $x=\frac13$ these two give with $\psi(1)=-\gamma$ and $\cot(\frac\pi 3)=\frac{1}{\sqrt 3}$:
$$
\psi(\frac13)+\psi(\frac23)-\gamma=-3\gamma-3\ln(3)\\
\psi(\frac23)-\psi(\frac13)=\frac{\pi}{\sqrt 3}
$$
Combined, this yields:
$$
\psi(\frac13)=-\gamma-\frac{3\ln(3)}{2}-\frac\pi{2\sqrt3}
$$
And the result follows.
A: First, we use the definition of the Euler-Mascheroni number
$$\gamma =\lim_{n\to \infty}\left(\sum_{k=1}^n\frac1k-\log n\right) \tag 1$$
Next, we write the sum of interest as
$$\begin{align}
\sum_{k=0}^{n}\frac{1}{pk+1}&=1+\frac1p \left(\sum_{k=1}^n\left(\frac{1}{k+1/p}-\frac1k\right)+\sum_{k=1}^n\frac1k \right)\\\\
&=1+\frac1p \sum_{k=1}^n\left(\frac{1}{k+1/p}-\frac1k\right)+\frac1p\left(\sum_{k=1}^n\frac1k -\log n\right)+\frac1p\log n\\\\
\sum_{k=0}^{n}\frac{1}{pk+1}-\frac1p\log n&=1+\frac1p \sum_{k=1}^n\left(\frac{1}{k+1/p}-\frac1k\right)+\frac1p\left(\sum_{k=1}^n\frac1k -\log n\right)\\\\
&=1+\frac1p \sum_{k=1}^n\left(\int_0^1x^{k+1/p-1}\,dx-\int_0^1x^{k-1}\,dx\right)\\\\
&+\frac1p\left(\sum_{k=1}^n\frac1k -\log n\right)\\\\
&=1+\frac1p \left(\int_0^1\frac{x^{1/p}-1}{1-x}\,dx\right)+\frac1p\left(\sum_{k=1}^n\frac1k -\log n\right) \tag 2\\\\
\end{align}$$
For $p=3$, we can evaluate the integral in $(2)$ in closed form.  Proceeding, we enforce the substitution $x\to x^3$.  Then,
$$\begin{align}
\int_0^1\frac{x^{1/3}-1}{1-x}\,dx&=3\int_0^1\frac{(x-1)x^2}{1-x^3}\,dx\\\\
&=-3\int_0^1\frac{x^2}{x^2+x+1}\,dx\\\\
&=-3+\frac{\pi\sqrt{3}}{6}+\frac32 \log 3 \tag 3
\end{align}$$
Using $(3)$ in $(2)$ with $p=3$ and taking the limit as $n\to \infty$ yields
$$\bbox[5px,border:2px solid #C0A000]{\lim_{n\to \infty}\left(\sum_{k=0}^{n}\frac{1}{3k+1}-\frac13\log n\right)=\frac 13\gamma +\frac{\pi\sqrt{3}}{18}+\frac12 \log 3}$$
as was to be shown.
For values of $p\in N$ different from $3$, one can still carry out the integral in $(2)$ and arrive at the limit
$$\bbox[5px,border:2px solid #C0A000]{\lim_{n\to \infty}\left(\sum_{k=0}^{n}\frac{1}{pk+1}-\frac1p\log n\right)=\frac 1p\gamma +\int_0^1\frac{1-x^{p-1}}{1-x^p}\,dx} \tag 4$$

NOTE:
Using Gauss's digamma theorem, we can evaluate the right-hand side of $(4)$ in closed form.  We obtain
$$\begin{align}
\lim_{n\to \infty}\left(\sum_{k=0}^{n}\frac{1}{pk+1}-\frac1p\log n\right)=\frac 1p\gamma +\frac1p\left(\log (2p)+\frac{\pi}{2}\cot\left(\frac{\pi}{p}\right)-2\sum_{k=1}^{\lfloor\frac{p-1}{2}\rfloor}\cos\left(\frac{2\pi k}{p}\right)\log\left(\sin\left(\frac{\pi k}{p}\right)\right)\right)
\end{align}$$
A: This is a job for the
digamma function
defined by
$$\psi(x)
=-\gamma+\sum_{n=0}^{\infty}\left(\frac1{n+1}-\frac1{n+x}\right)
$$
(look here:
https://en.wikipedia.org/wiki/Digamma_function
)
user109899
has manipulated the sum
directly and nicely
into the
digamma function
$\psi(1/3)$.
$$\sum_{k=0}^{\infty}\left(\frac{1}{k+\frac13}-\frac{1}{k+1}\right)
=-\sum_{k=0}^{\infty}\left(\frac{1}{k+1}-\frac{1}{k+\frac13}\right)
=-(\psi(1/3)+\gamma)
$$
and,
according to that
Wikipedia article,
$$\psi(1/3)
=-\frac{\pi}{2\sqrt{3}}-\frac32 \ln 3 -\gamma.
$$
