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 Stark–Heegner theorem there are precisely nine Heegner numbers:
Euler's prime-generating polynomial 
Euler's prime-generating polynomial
which gives (distinct) 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 equals minus a Heegner number.
(Note that yields , so is maximal.) 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.
Almost integers and Ramanujan's constant 
- 262,537,412,640,768,743.999 999 999 999 25…
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.
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 (monic integral) polynomial it satisfies is called the Hilbert class polynomial. Thus if the imaginary quadratic extension has class number 1 (so d is a Heegner number), the j-invariant is an integer.
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,
where the linear term of the error is,
explaining why is within approximately the above of being an integer.
Other Heegner numbers 
For the four largest Heegner numbers, the approximations one obtains are as follows.
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, (which are simply algebraic numbers of degree 1), can also 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. In addition, they can also be closely approximated by algebraic numbers of degree 4,
Note the reappearance of the integers as well as the fact that,
which, with the appropriate fractional power, are precisely the j-invariants. As well as 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 (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 , then,
where the eta quotients are the algebraic numbers given above.
Consecutive primes 
Given an odd prime p, if one computes for (this is sufficient because ), 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.
Notes and references 
- Conway, John Horton; Guy, Richard K. (1996). The Book of Numbers. Springer. p. 224. ISBN 0-387-97993-X.
- Rabinowitz, G. "Eindeutigkeit der Zerlegung in Primzahlfaktoren in quadratischen Zahlkörpern." Proc. Fifth Internat. Congress Math. (Cambridge) 1, 418–421, 1913.
- Le Lionnais, F. Les nombres remarquables. Paris: Hermann, pp. 88 and 144, 1983.
- Weisstein, Eric W., "Transcendental Number", MathWorld. gives , based on Nesterenko, Yu. V. "On Algebraic Independence of the Components of Solutions of a System of Linear Differential Equations." Izv. Akad. Nauk SSSR, Ser. Mat. 38, 495–512, 1974. English translation in Math. USSR 8, 501–518, 1974.
- Ramanujan Constant – from Wolfram MathWorld
- Barrow, John D (2002). The Constants of Nature. London: Jonathan Cape. ISBN 0-224-06135-6.
- Gardner, Martin (April 1975). "Mathematical Games". Scientific American (Scientific American, Inc) 232 (4): 127.
- These can be checked by computing on a calculator, and for the linear term of the error.
- The absolute deviation of a random real number (picked uniformly from [0,1], say) is a uniformly distributed variable on [0, 0.5], so it has absolute average deviation and median absolute deviation of 0.25, and a deviation of 0.22 is not exceptional.
- "Pi Formulas".
- "Extending Ramanujan's Dedekind Eta Quotients".
- Weisstein, Eric W., "Heegner Number", MathWorld.
- "Sloane's A003173 : Heegner numbers: imaginary quadratic fields with unique factorization", The On-Line Encyclopedia of Integer Sequences. OEIS Foundation.
- Gauss' Class Number Problem for Imaginary Quadratic Fields, by Dorian Goldfeld: Detailed history of problem.
- Clark, Alex. "163 and Ramanujan Constant". Numberphile. Brady Haran.