Approximation of $e^{\pi\sqrt{n}}$ using Ramanujan's Class Invariants

From Wikipedia article we get

$\displaystyle \begin{aligned}e^{\pi\sqrt{43}} &\approx 884736743.999777466 \\
e^{\pi\sqrt{67}} &\approx 147197952743.999998662454\\
e^{\pi\sqrt{163}}&\approx 262537412640768743.99999999999925007 \end{aligned}$

In his paper “Modular equations and approximations to $\pi$” Ramanujan gives a very simple approach to find these approximations and show that they are almost integers. I quote from the paper:


Since $G_{n}, g_{n}$ can be expressed as roots of algebraical equations with rational coefficients, the same is true of $G_{n}^{24}$ or $g_{n}^{24}$. So let’s us suppose that $$1 = ag_{n}^{-24} – bg_{n}^{-48} + \cdots\\
\text{or }g_{n}^{24} = a – bg_{n}^{-24} + \cdots$$ But we know that $$64e^{-\pi\sqrt{n}}g_{n}^{24} = 1 – 24e^{-\pi\sqrt{n}} + 276e^{-2\pi\sqrt{n}} + \cdots\\
64g_{n}^{24} = e^{\pi\sqrt{n}} – 24 + 276e^{-\pi\sqrt{n}} + \cdots\\
64a – 64bg_{n}^{-24} + \cdots = e^{\pi\sqrt{n}} – 24 + 276e^{-\pi\sqrt{n}} + \cdots\\
64a – 4096be^{-\pi\sqrt{n}} + \cdots = e^{\pi\sqrt{n}} – 24 + 276e^{-\pi\sqrt{n}} + \cdots\\
\text{that is }e^{\pi\sqrt{n}} = (64a + 24) – (4096b + 276)e^{-\pi\sqrt{n}} + \cdots$$


Here we have standard definitions $$G_{n} = 2^{-1/4}e^{\pi\sqrt{n}/24}(1 + e^{-\pi\sqrt{n}})(1 + e^{-3\pi\sqrt{n}})(1 + e^{-5\pi\sqrt{n}})\cdots$$ and $$g_{n} = 2^{-1/4}e^{\pi\sqrt{n}/24}(1 – e^{-\pi\sqrt{n}})(1 – e^{-3\pi\sqrt{n}})(1 – e^{-5\pi\sqrt{n}})\cdots$$ From the theory of modular equations I understand that the values $g_{n}, G_{n}$ are algebraic numbers if $n > 0$ is rational. But this does not make them make algebraic integers. I am therefore not able to understand how Ramanujan uses the numbers $a, b$ in the derivations above as integers and is able to conclude that the value of $e^{\pi\sqrt{n}}$ is close to the integer $(64a + 24)$. I believe the approach provided above works only when $g_{n}, G_{n}$ are algebraic integers. Please let me know if we can conclude $e^{\pi\sqrt{n}}$ is an almost integer even if $g_{n}$ is algebraic but not algebraic integer.

Solutions Collecting From Web of "Approximation of $e^{\pi\sqrt{n}}$ using Ramanujan's Class Invariants"

According to your derivation, the near-integer result already holds
when $64a$ is an integer.
For this, it suffices that $64 g_n^{24}$ is an algebraic integer.

Using Weber modular functions,
we have
$$\begin{align}
G_n &= 2^{-1/4}\mathfrak{f}(\sqrt{-n})
& g_n &= 2^{-1/4}\mathfrak{f}_1(\sqrt{-n})
\\\therefore\quad 64 G_n^{24} &= \mathfrak{f}^{24}(\sqrt{-n})
& 64 g_n^{24} &= \mathfrak{f}_1^{24}(\sqrt{-n})
\end{align}$$
Relating this to the modular j-Function, we get
$$\begin{align}
(X+16)^3 – \operatorname{j}X &= 0
\quad\text{for}\quad
X\in\{-\mathfrak{f}^{24},\mathfrak{f}_1^{24},\mathfrak{f}_2^{24}\}
\end{align}$$
which makes the values of $\mathfrak{f}^{24}$ and $\mathfrak{f}_1^{24}$
algebraic integers whenever $\operatorname{j}$ takes the value of an algebraic
integer.
You know that this is the case for the examples given,
and this carries over to $64 G_n^{24}$ and $64 g_n^{24}$.