I've been prodded to ask a question expanding [this one on Ramanujan's constant](https://mathoverflow.net/questions/4741/a-very-very-good-approximation-to-ramanujan-constant-why-closed) $R=\exp(\pi\sqrt{163})$.


Recall that $R$ is very close to an integer; specifically $R=262537412640768744 - \epsilon$ where $\epsilon$ is about $0.75 \times 10^{-12}$. Call the integer here $N$, so $R = N - \epsilon$.


So $R^2 = N^2 - 2N\epsilon + \epsilon^2$. It turns out that $N\epsilon$ is itself nearly an integer, namely $196884$, and so $R^2$ is again an almost-integer. More precisely,


$$j(\tau) = 1/q + 744 + 196884q + 21493760q^2 + O(q^3)$$


where $q = \exp(2\pi i\tau)$. For $\tau = (1+\sqrt{-163})/2$, and hence $q = \exp(-\pi\sqrt{163})$, it's known that the left-hand side is an integer. Squaring both sides,


$$j(\tau)^2 = 1/q^2 + 1488/q + 974304 + 335950912q + O(q^2).$$


To show that $1/q^2$ is nearly an integer, we can rearrange a bit to get


$$j(\tau)^2 - 1/q^2 - 974304 = 1488/q + 335950912q + O(q^2)$$


and we want the left-hand side to be nearly zero. $1488/q$ is nearly an integer since $1/q$ is nearly an integer; since q is small the higher-order terms on the right-hand side are small. 


As noted by [Mark Thomas in this question](https://mathoverflow.net/questions/4741/a-very-very-good-approximation-to-ramanujan-constant-why-closed), $R^5$ is also very close to an integer -- but as I pointed out, that integer is not $N^5$. This isn't special to fifth powers. $R$, $R^2$, $R^3$, $R^4$, $R^5$, $R^6$, respectively differ from the nearest integer by less than $10^{-12}$, $10^{-9}$, $10^{-8}$, $10^{-6}$, $10^{-5}$, $10^{-4}$, and $10^{-2}$. But the method of proof outlined above doesn't work for higher powers, since the coefficients of the $q$-expansion of $j(\tau)^5$ (for example) grow too quickly. Is there some explanation for the fact that these higher powers are almost integers?



Why are powers of $\exp(\pi\sqrt{163})$ almost integers?
Another take on this:


As David Speyer and FC's answer shows, this question can be answered without any additional deep theory.


However, I'd like to explain a variant on their arguments that puts this in a little more context regarding modular forms. It also means we can use a technique which makes it easier to see how good these approximations are in terms of the growth rate of the coeffients of the j-function.


The important fact here is that any modular function (for SL\_2(Z)) with integer coefficients in its q-expansion takes on integer values at τ = (1+√(-163))/2 (and so q = exp(-π√163)). This fact is in fact a consequence of the integrality of the j-value here, since any such function can be expressed as a polynomial in j with integer coefficients (although similar things are true in other contexts, such as modular functions of higher level, where there is not a canonical generator for the ring of such modular invariants).


This means that, just as we can use the integrality of


$j(\tau) = q^{-1} + 744 + O(q) $


to get an integer approximation to $q^{-1}$, if we have a modular function $f\_n$ with power series of the form


$f\_n(\tau) = q^{-n} + integer + O(q)$,


we can get an integer approximation to $q^{-n}$. How good this approximation is will depend upon the size of the coefficients of the power series for the $O(q)$ part.


Fortunately for us, such a function $f\_n$ always exists (and is unique up to adding integer constants). How can we construct it? One way is to take an appropriate polynomial in $j$, that is, take an appropriate linear combination of $j, j^2, \cdots , j^n$ to get a function with the right principal part. This clearly works, and if one works out the details, it should turn out equivalent to FC's and David's approach.


However, now that we're in the modular forms mindset, we have other tools at our disposal. In particular, another way to create new modular functions is to apply Hecke operators to existing modular functions, such as $j$. This turns out to be an effective way to get modular functions of the type we need, since Hecke operators do predictable things to principal parts of q-series (for example, if $p$ is prime, $T\_p j = q^{-p} + O(1)$). I'll just explain how this works for $n = 5$, although the method should generalize immediately to any prime $n$ (composite $n$ might be a little trickier, but not much).


The theory of Hecke operators tells us that the function $T\_5 j$ defined by


$$(T\_5 j)(z) = j(5 z) + \sum\_{i \ mod \ 5} j (\frac{z + i}{5})$$


is modular, with q-expansion given by


$$(T\_5 j)(\tau) = q^{-5} + \sum\_{n = 0}^{\infty} (5 c\_{5n} + c\_{n/5}) q^n$$.


where the $c\_n$ are the coefficients in


$$j(\tau) = q^{-1} + \sum\_{n = 0}^{\infty} c\_n q^n$$


(and $c\_n = 0$ if $n$ is not an integer).


So if as before we set $q = e^{- \pi \sqrt{163}}$, we find that


$q^{-5} + 6 c\_0 + 5 c\_5 q + 5 c\_{10} q^2 + 5 c\_{15} q^3 + 5 c\_{20} q^4 + (c\_1 + 5 c\_{25}) q^5 + \dots$


is an integer.


Now, $q$ is roughly $4 \cdot 10^{-18}$, and looking up the coefficients for $j(z)$ on [OEIS](http://oeis.org/A000521 "OEIS"), we find that


$q^{-5} + 6 \cdot 744 + 5 \cdot (\sim 3\cdot 10^{11}) (\sim 4\cdot10^{-18}) + \text{clearly smaller terms}$


is an integer. Hence $q^{-5}$ should be off from an integer by roughly $6 \cdot 10^{-6}$. This agrees pretty well with what Wolfram Alpha is giving me (it wouldn't be hard to get more digits here, but I'm feeling back-of-the-envelope right now and will call it a night :-)


