# Heegner number

In number theory, a Heegner number (as termed by Conway and Guy) is a square-free positive integer d such that the imaginary quadratic field $\mathbb {Q} \left[{\sqrt {-d}}\right]$ has class number 1. Equivalently, the ring of algebraic integers of $\mathbb {Q} \left[{\sqrt {-d}}\right]$ has unique factorization.
The determination of such numbers is a special case of the class number problem, and they underlie several striking results in number theory.
According to the (Baker–)Stark–Heegner theorem there are precisely nine Heegner numbers:
This result was conjectured by Gauss and proved up to minor flaws by Kurt Heegner in 1952. Alan Baker and Harold Stark independently proved the result in 1966, and Stark further indicated that the gap in Heegner's proof was minor.

## Euler's prime-generating polynomial

Euler's prime-generating polynomial $n^{2}+n+41,$ which gives (distinct) primes for n = 0, ..., 39, is related to the Heegner number 163 = 4 · 41 − 1.
Rabinowitsch proved that $n^{2}+n+p$ gives primes for $n=0,\dots ,p-2$ if and only if this quadratic's discriminant $1-4p$ is the negative of a Heegner number.
(Note that $p-1$ yields $p^{2}$, so $p-2$ is maximal.)
1, 2, and 3 are not of the required form, so the Heegner numbers that work are 7, 11, 19, 43, 67, 163, yielding prime generating functions of Euler's form for 2, 3, 5, 11, 17, 41; these latter numbers are called lucky numbers of Euler by F. Le Lionnais.

## Almost integers and Ramanujan's constant

Ramanujan's constant is the transcendental number $e^{\pi {\sqrt {163}}}$, which is an almost integer: $e^{\pi {\sqrt {163}}}=262\,537\,412\,640\,768\,743.999\,999\,999\,999\,25\ldots \approx 640\,320^{3}+744.$
This number was discovered in 1859 by the mathematician Charles Hermite. In a 1975 April Fool article in Scientific American magazine, "Mathematical Games" columnist Martin Gardner made the hoax claim that the number was in fact an integer, and that the Indian mathematical genius Srinivasa Ramanujan had predicted it – hence its name. In this wise it has as a spurious provenance as the Feynman point.
This coincidence is explained by complex multiplication and the q-expansion of the j-invariant.

### Detail

In what follows, j(z) denotes the j-invariant of the complex number z. Briefly, $\textstyle j\left({\frac {1+{\sqrt {-d}}}{2}}\right)$ is an integer for d a Heegner number, and $e^{\pi {\sqrt {d}}}\approx -j\left({\frac {1+{\sqrt {-d}}}{2}}\right)+744$ via the q-expansion.
If $\tau$ is a quadratic irrational, then its j-invariant $j(\tau )$ is an algebraic integer of degree $\left|\mathrm {Cl} {\bigl\mathbf {Q} (\tau ){\bigr )}\right|$, the class number of $\mathbf {Q} (\tau )$ and the minimal (monic integral) polynomial it satisfies is called the 'Hilbert class polynomial'. Thus if the imaginary quadratic extension $\mathbf {Q} (\tau )$ has class number 1 (so d is a Heegner number), the j-invariant is an integer.
The q-expansion of j, with its Fourier series expansion written as a Laurent series in terms of $q=e^{2\pi i\tau }$, begins as: $j(\tau )={\frac {1}{q}}+744+196\,884q+\cdots .$
The coefficients $c_{n}$ asymptotically grow as $\ln(c_{n})\sim 4\pi {\sqrt {n}}+O{\bigl\ln(n){\bigr )},$ and the low order coefficients grow more slowly than $200\,000^{n}$, so for $\textstyle q\ll {\frac {1}{200\,000}}$, j is very well approximated by its first two terms. Setting $\textstyle \tau ={\frac {1+{\sqrt {-163}}}{2}}$ yields $q=-e^{-\pi {\sqrt {163}}}\quad \therefore \quad {\frac {1}{q}}=-e^{\pi {\sqrt {163}}}.$ Now $j\left({\frac {1+{\sqrt {-163}}}{2}}\right)=\left(-640\,320\right)^{3},$ so, $\left(-640\,320\right)^{3}=-e^{\pi {\sqrt {163}}}+744+O\left(e^{-\pi {\sqrt {163}}}\right).$ Or, $e^{\pi {\sqrt {163}}}=640\,320^{3}+744+O\left(e^{-\pi {\sqrt {163}}}\right)$ where the linear term of the error is, ${\frac {-196\,884}{e^{\pi {\sqrt {163}}}}}\approx {\frac {-196\,884}{640\,320^{3}+744}}\approx -0.000\,000\,000\,000\,75$ explaining why $e^{\pi {\sqrt {163}}}$ is within approximately the above of being an integer.

## Pi formulas

The Chudnovsky brothers found in 1987 that ${\frac {1}{\pi }}={\frac {12}{640\,320^{\frac {3}{2}}}}\sum _{k=0}^{\infty }{\frac {(6k)!(163\cdot 3\,344\,418k+13\,591\,409)}{(3k)!(k!)^{3}(-640\,320)^{3k}}},$ a proof of which uses the fact that $j\left({\frac {1+{\sqrt {-163}}}{2}}\right)=-640\,320^{3}.$ For similar formulas, see the Ramanujan–Sato series.

## Other Heegner numbers

For the four largest Heegner numbers, the approximations one obtains are as follows. ${\begin{aligned}e^{\pi {\sqrt {19}}}&\approx {\phantom {000\,0}}96^{3}+744-0.22\\e^{\pi {\sqrt {43}}}&\approx {\phantom {000\,}}960^{3}+744-0.000\,22\\e^{\pi {\sqrt {67}}}&\approx {\phantom {00}}5\,280^{3}+744-0.000\,0013\\e^{\pi {\sqrt {163}}}&\approx 640\,320^{3}+744-0.000\,000\,000\,000\,75\end{aligned}}$
Alternatively, ${\begin{aligned}e^{\pi {\sqrt {19}}}&\approx 12^{3}\left(3^{2}-1\right)^{3}{\phantom {00}}+744-0.22\\e^{\pi {\sqrt {43}}}&\approx 12^{3}\left(9^{2}-1\right)^{3}{\phantom {00}}+744-0.000\,22\\e^{\pi {\sqrt {67}}}&\approx 12^{3}\left(21^{2}-1\right)^{3}{\phantom {0}}+744-0.000\,0013\\e^{\pi {\sqrt {163}}}&\approx 12^{3}\left(231^{2}-1\right)^{3}+744-0.000\,000\,000\,000\,75\end{aligned}}$ where the reason for the squares is due to certain Eisenstein series. For Heegner numbers $d<19$, one does not obtain an almost integer; even $d=19$ is not noteworthy. The integer j-invariants are highly factorisable, which follows from the form
    $12^{3}\left(n^{2}-1\right)^{3}=\left(2^{2}\cdot 3\cdot (n-1)\cdot (n+1)\right)^{3},$
and factor as, ${\begin{aligned}j\left({\frac {1+{\sqrt {-19}}}{2}}\right)&={\phantom {000\,0}}-96^{3}=-\left(2^{5}\cdot 3\right)^{3}\\j\left({\frac {1+{\sqrt {-43}}}{2}}\right)&={\phantom {000\,}}-960^{3}=-\left(2^{6}\cdot 3\cdot 5\right)^{3}\\j\left({\frac {1+{\sqrt {-67}}}{2}}\right)&={\phantom {00}}-5\,280^{3}=-\left(2^{5}\cdot 3\cdot 5\cdot 11\right)^{3}\\j\left({\frac {1+{\sqrt {-163}}}{2}}\right)&=-640\,320^{3}=-\left(2^{6}\cdot 3\cdot 5\cdot 23\cdot 29\right)^{3}.\end{aligned}}$
These transcendental numbers, in addition to being closely approximated by integers (which are simply algebraic numbers of degree 1), can be closely approximated by algebraic numbers of degree 3, ${\begin{aligned}e^{\pi {\sqrt {19}}}&\approx x^{24}-24.000\,31;&x^{3}-2x-2&=0\\e^{\pi {\sqrt {43}}}&\approx x^{24}-24.000\,000\,31;&x^{3}-2x^{2}-2&=0\\e^{\pi {\sqrt {67}}}&\approx x^{24}-24.000\,000\,0019;&x^{3}-2x^{2}-2x-2&=0\\e^{\pi {\sqrt {163}}}&\approx x^{24}-24.000\,000\,000\,000\,0011;&\quad x^{3}-6x^{2}+4x-2&=0\end{aligned}}$
The roots of the cubics can be exactly given by quotients of the Dedekind eta function η(τ), a modular function involving a 24th root, and which explains the 24 in the approximation. They can also be closely approximated by algebraic numbers of degree 4, ${\begin{aligned}e^{\pi {\sqrt {19}}}&\approx 3^{5}\left(3-{\sqrt {2\left(1-{\tfrac {96}{24}}+1{\sqrt {3\cdot 19}}\right)}}\right)^{-2}-12.000\,06\dots \\e^{\pi {\sqrt {43}}}&\approx 3^{5}\left(9-{\sqrt {2\left(1-{\tfrac {960}{24}}+7{\sqrt {3\cdot 43}}\right)}}\right)^{-2}-12.000\,000\,061\dots \\e^{\pi {\sqrt {67}}}&\approx 3^{5}\left(21-{\sqrt {2\left(1-{\tfrac {5\,280}{24}}+31{\sqrt {3\cdot 67}}\right)}}\right)^{-2}-12.000\,000\,000\,36\dots \\e^{\pi {\sqrt {163}}}&\approx 3^{5}\left(231-{\sqrt {2\left(1-{\tfrac {640\,320}{24}}+2\,413{\sqrt {3\cdot 163}}\right)}}\right)^{-2}-12.000\,000\,000\,000\,000\,21\dots \end{aligned}}$
If $x$ denotes the expression within the parenthesis (e.g. $x=3-{\sqrt {2\left(1-{\tfrac {96}{24}}+1{\sqrt {3\cdot 19}}\right)}}$), it satisfies respectively the quartic equations ${\begin{aligned}x^{4}-{\phantom {00}}4\cdot 3x^{3}+{\phantom {000\,0}}{\tfrac {2}{3}}(96+3)x^{2}-{\phantom {000\,000}}{\tfrac {2}{3}}\cdot 3(96-6)x-3&=0\\x^{4}-{\phantom {00}}4\cdot 9x^{3}+{\phantom {000\,}}{\tfrac {2}{3}}(960+3)x^{2}-{\phantom {000\,00}}{\tfrac {2}{3}}\cdot 9(960-6)x-3&=0\\x^{4}-{\phantom {0}}4\cdot 21x^{3}+{\phantom {00}}{\tfrac {2}{3}}(5\,280+3)x^{2}-{\phantom {000}}{\tfrac {2}{3}}\cdot 21(5\,280-6)x-3&=0\\x^{4}-4\cdot 231x^{3}+{\tfrac {2}{3}}(640\,320+3)x^{2}-{\tfrac {2}{3}}\cdot 231(640\,320-6)x-3&=0\\\end{aligned}}$
Note the reappearance of the integers $n=3,9,21,231$ as well as the fact that ${\begin{aligned}2^{6}\cdot 3\left(-\left(1-{\tfrac {96}{24}}\right)^{2}+1^{2}\cdot 3\cdot 19\right)&=96^{2}\\2^{6}\cdot 3\left(-\left(1-{\tfrac {960}{24}}\right)^{2}+7^{2}\cdot 3\cdot 43\right)&=960^{2}\\2^{6}\cdot 3\left(-\left(1-{\tfrac {5\,280}{24}}\right)^{2}+31^{2}\cdot 3\cdot 67\right)&=5\,280^{2}\\2^{6}\cdot 3\left(-\left(1-{\tfrac {640\,320}{24}}\right)^{2}+2413^{2}\cdot 3\cdot 163\right)&=640\,320^{2}\end{aligned}}$ which, with the appropriate fractional power, are precisely the j-invariants.
Similarly for algebraic numbers of degree 6, ${\begin{aligned}e^{\pi {\sqrt {19}}}&\approx \left(5x\right)^{3}-6.000\,010\dots \\e^{\pi {\sqrt {43}}}&\approx \left(5x\right)^{3}-6.000\,000\,010\dots \\e^{\pi {\sqrt {67}}}&\approx \left(5x\right)^{3}-6.000\,000\,000\,061\dots \\e^{\pi {\sqrt {163}}}&\approx \left(5x\right)^{3}-6.000\,000\,000\,000\,000\,034\dots \end{aligned}}$
where the xs are given respectively by the appropriate root of the sextic equations, ${\begin{aligned}5x^{6}-{\phantom {000\,0}}96x^{5}-10x^{3}+1&=0\\5x^{6}-{\phantom {000\,}}960x^{5}-10x^{3}+1&=0\\5x^{6}-{\phantom {00}}5\,280x^{5}-10x^{3}+1&=0\\5x^{6}-640\,320x^{5}-10x^{3}+1&=0\end{aligned}}$
with the j-invariants appearing again. These sextics are not only algebraic, they are also solvable in radicals as they factor into two cubics over the extension $\mathbb {Q} {\sqrt {5}}$ (with the first factoring further into two quadratics). These algebraic approximations can be exactly expressed in terms of Dedekind eta quotients. As an example, let $\textstyle \tau ={\frac {1+{\sqrt {-163}}}{2}}$, then, ${\begin{aligned}e^{\pi {\sqrt {163}}}&=\left({\frac {e^{\frac {\pi i}{24}}\eta (\tau )}{\eta (2\tau )}}\right)^{24}-24.000\,000\,000\,000\,001\,05\dots \\e^{\pi {\sqrt {163}}}&=\left({\frac {e^{\frac {\pi i}{12}}\eta (\tau )}{\eta (3\tau )}}\right)^{12}-12.000\,000\,000\,000\,000\,21\dots \\e^{\pi {\sqrt {163}}}&=\left({\frac {e^{\frac {\pi i}{6}}\eta (\tau )}{\eta (5\tau )}}\right)^{6}-6.000\,000\,000\,000\,000\,034\dots \end{aligned}}$
where the eta quotients are the algebraic numbers given above.

## Class 2 numbers

The three numbers 88, 148, 232, for which the imaginary quadratic field $\mathbb {Q} \left[{\sqrt {-d}}\right]$ has class number 2, are not Heegner numbers but have certain similar properties in terms of almost integers. For instance, ${\begin{aligned}e^{\pi {\sqrt {88}}}+8\,744&\approx {\phantom {00\,00}}2\,508\,952^{2}-0.077\dots \\e^{\pi {\sqrt {148}}}+8\,744&\approx {\phantom {00\,}}199\,148\,648^{2}-0.000\,97\dots \\e^{\pi {\sqrt {232}}}+8\,744&\approx 24\,591\,257\,752^{2}-0.000\,0078\dots \\\end{aligned}}$ and ${\begin{aligned}e^{\pi {\sqrt {22}}}-24&\approx {\phantom {00}}\left(6+4{\sqrt {2}}\right)^{6}+0.000\,11\dots \\e^{\pi {\sqrt {37}}}+24&\approx \left(12+2{\sqrt {37}}\right)^{6}-0.000\,0014\dots \\e^{\pi {\sqrt {58}}}-24&\approx \left(27+5{\sqrt {29}}\right)^{6}-0.000\,000\,0011\dots \\\end{aligned}}$

## Consecutive primes

Given an odd prime p, if one computes $k^{2}\mod p$ for $\textstyle k=0,1,\dots ,{\frac {p-1}{2}}$ (this is sufficient because $\left(p-k\right)^{2}\equiv k^{2}\mod p$), one gets consecutive composites, followed by consecutive primes, if and only if p is a Heegner number.
For details, see "Quadratic Polynomials Producing Consecutive Distinct Primes and Class Groups of Complex Quadratic Fields" by Richard Mollin.