Euler's prime-generating polynomial which gives primes for n = 1, ..., 40, is related to the Heegner number 163 = 4 · 41 − 1. Euler's formula, with taking the values 1,... 40 is equivalent to with taking the values 0,... 39, and Rabinowitz proved that gives primes for if and only if its discriminant is the negative of a Heegner number. 1, 2, and 3 are not of the required form, so the Heegner numbers that work are, yielding prime generating functions of Euler's form for ; these latter numbers are called lucky numbers of Euler by F. Le Lionnais.
Briefly, is an integer for d a Heegner number, and via the q-expansion. If is a quadratic irrational, then the j-invariant is an algebraic integer of degree, the class number of and the minimal polynomial it satisfies is called the 'Hilbert class polynomial'. Thus if the imaginary quadratic extension has class number 1, the j-invariant is an integer. The q-expansion of j, with its Fourier series expansion written as a Laurent series in terms of, begins as: The coefficients asymptotically grow as, and the low order coefficients grow more slowly than, so for, j is very well approximated by its first two terms. Setting yields or equivalently,. Now, so, Or, where the linear term of the error is, explaining why is within approximately the above of being an integer.
For the four largest Heegner numbers, the approximations one obtains are as follows. Alternatively, where the reason for the squares is due to certain Eisenstein series. For Heegner numbers, one does not obtain an almost integer; even is not noteworthy. The integer j-invariants are highly factorisable, which follows from the form, and factor as, These transcendental numbers, in addition to being closely approximated by integers, can be closely approximated by algebraic numbers of degree 3, 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, If denotes the expression in the parenthesis, it satisfies respectively the quartic equations Note the reappearance of the integers as well as the fact that which, with the appropriate fractional power, are precisely the j-invariants. Similarly for algebraic numbers of degree 6, where the xs are given respectively by the appropriate root of the sextic equations, 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 . These algebraic approximations can be exactly expressed in terms of Dedekind eta quotients. As an example, let, then, where the eta quotients are the algebraic numbers given above.
The three numbers, for which the imaginary quadratic field has class number, are not considered as Heegner numbers but have certain similar properties in terms of almost integers. For instance, we have and
Consecutive primes
Given an odd primep, if one computes for , 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.