Today I entered the following expression in maple:
$$a\_i = H\_{10^i} - ln(10^i) - \gamma$$
Here $H\_j$ equals $\sum\_{k=1}^{j} 1/k$ and $\gamma$ is the Euler-Mascheroni constant. 


When I computed $a\_n$ for $i = 0$ to $10$ I obtained the following results:


* $i = 0$;    4.227843350984671393934879099175975689578406640600764011942327651151323 \* $10^{-1}$

* $i=1$;   4.9167496072675423629464709201487329610707429399557393414873118115813 \* $10^{-2}$

* $i=2$;   4.991666749996032162622676207122311664609813510982102304110919767206 \* $10^{-3}$

* $i=3;$   4.999166666749999960317501984051226762153678825611388678758121701133 \* $10^{-4}$

* $i=4$;   4.99991666666674999999960317460734126976551226762154503821179264423 \* $10^{-5}$

* $i=5$;   4.9999916666666667499999999960317460321626984126226551226762154523 \* $10^{-6}$

* $i=6$;   4.999999166666666666749999999999960317460317501984126984051226523 \* $10^{-7}$

* $i=7$;   4.99999991666666666666674999999999999960317460317460734126984123 \* $10^{-8}$

* $i=8$;   
4.9999999916666666666666667499999999999999960317460317460321623 \* $10^{-9}$

* $i=9$;   
4.999999999166666666666666666749999999999999999960317460317423 \* $10^{-10}$ 

* $i=10$;
4.99999999991666666666666666666674999999999999999999960317423 \* $10^{-11}$


So we see that the periodic strips of ...99999..., of ...66666... and ...99999... an many other periods increase for even larger $i$. The question is now: Is there any rule behind it that the remainder term $a\_i$ behaves that way?



Interesting result on the Euler-Maschroni constant - what is the background?
Yes, there is a rule. There are results that are finer than merely $H\_k - \ln k - \gamma$ tends to $0$ and explain this pattern.


More specifically, let us consider some more terms of the asymtotic expansion of $H\_k$ . One has for example
$$H\_k = \ln k + \gamma + \frac{1}{2k} - \frac{1}{12k^2} + O(k^{-4}) $$ 
and this is even true with a small implied constant, or more precisely this is true with $O(k^{-4})$ 
replaced by $x\_k\frac{1}{120}k^{-4}$ with $0 \le x\_k \le 1$.
Thus the error to be expected when doing the calculation in the question is 
$$\frac{1}{2k} - \frac{1}{12k^2}$$ up to something still (much) smaller. 


This is precisely what one sees; if one chooses for $k$ a power of $10$ one sees a nice pattern (the $10$ being special due to the fact that one has the decimal representation; if one chooses a different base for the representation, powers of that base become special); it is the beginning of the decimal representation of $$\frac{1}{2} 10^{-j} - \frac{1}{12} 10^{-2j} ;$$ 
how long it is really just this can also be known from the estimate of the error mentioned above.


One can continue on this, as it is known that 
$$H\_k = \ln k + \gamma + \frac{1}{2k} - \sum\_{i=1}^{n-1} \frac{B\_{2i}}{2i k^{2i}} + O(k^{-2n})$$
and more precisely the $O(n^{-2k})$ can be replaced by $x\_{k,n}( -\frac{B\_{2n}}{2n}) k^{-2n} $ with 
$0\le x\_{k,n} \le 1$ where the $B$'s are the [Bernoulli numbers](http://en.wikipedia.org/wiki/Bernoulli_number); some care is needed if one would want to try to see more complex patterns as the Bernoulli numbers while small at first then grow very fast, so that then the implied constant is large and the $k$ needs to be sufficiently large (relative to the $n$) to see the pattern for all the terms. 


Besides the approximation I mentiond above there are various other approximations known. Also, questions like this are closely linked, essentially equivalent, to questions on the [Digamma function](http://en.wikipedia.org/wiki/Digamma_function) .


