The fact that Ramanujan's Constant $e^{\pi \sqrt{163}}$ is almost an integer ($262 537 412 640 768 743.99999999999925...$) doesn't seem to be a coincidence, but has to do with the $163$ appearing in it. Can you explain why it's almost-but-not-quite an integer in layman's terms (I'm not a mathematician)?

Pete L. Clark
  • 93,404
  • 10
  • 203
  • 348
  • 2,446
  • 4
  • 19
  • 25
  • 8
    http://mathoverflow.net/questions/30787 and http://mathoverflow.net/questions/4775 are relevant, but let's see somebody try to explain it without saying "modular". ;) – J. M. ain't a mathematician Sep 13 '10 at 16:01
  • 22
    This is not really the kind of phenomenon with a layman's-terms explanation... – Qiaochu Yuan Sep 13 '10 at 16:01
  • 3
  • I observed yet another interesting (IMHO) "almost an integer" related to exp(Pi*sqrt(163)) result, which is: sum((1/(exp(Pi*sqrt(163))^k))*(120/(8*k+1)-60/(8*k+4)-30/(8*k+5)-30/(8*k+6)), k = 0 ... infinity) = 94.000000000000000014789449792044364408558923807659819... Regards, Alexander R. Povolotsky – Alex Jun 24 '12 at 15:12
  • I'm sorry but this is a terrible question and doesn't fit the model of SE. I'm appalled by the number of upvotes it got. To the OP: please explain what kind of answer you expect from asking why a number is what it is. Also, the **(number theory)** tag absolutely does not belong. – chharvey Jul 15 '15 at 02:52
  • 2
    similar question: "can you explain why $2+\sqrt[3]{\frac{1}{e^{10\pi}}}$ is almost-but-not-quite an integer?" – chharvey Jul 15 '15 at 03:08
  • 11
    @chharvey The answers below seem to indicate that there *is* a mathematical explanation for why the expression is almost integral. –  Jul 15 '15 at 05:39
  • 1
    @Strants — I'm not saying it can't be answered, I'm just saying "almost" is relative. By that logic, you could argue 10 is "almost" equal to 100 (compared to, for example, $-10^{100}$). And because "almost" is relative, it's not a very good question to ask on math.SE. – chharvey Jul 15 '15 at 17:46
  • 9
    @chharvey: Bullshit. Even despite the excellent answers clearly demonstrating that this nice (and, have to add, for your attitude: "brave") question indeed has merit, you still intentionally ignored the obvious context, just to rant on it, and continued your misguided policing even after Strants's comment, when no-one at their right mind would still compare the statement about that fascinating expression being x.99999999999925, i.e. "almost an integer" to "10 almost being 100", as you did in your comment. To quote you "I'm appalled by the number of upvotes it got". ;) – Sz. Oct 13 '18 at 23:40
  • In the book Galois Theory for Beginners: A Historical Perspective Page xi (12 of 202) (https://bookstore.ams.org/stml-35/12), via "numeric calculation", it is stated that exp(pi \times sqrt(163)) = 262537412640768744. How is this justified, since it clearly is not an integral quantity? – DavidH Feb 20 '20 at 19:25

4 Answers4


This is quite a challenge to express in "layman's terms", but the reason is that $$j\left(\frac{1+\sqrt{-163}}{2}\right)$$ is an integer where $j$ is the $j$-function. When you substitute $(1+\sqrt{-163})/2$ into the $q$-expansion (see the wikipedia page) of $j$, all terms save the first two are small, and the first two equal $$-\exp(\pi\sqrt{163})+744.$$

The reason that this $j$-value is an integer is due to the quadratic field $\mathbb{Q}(\sqrt{-163})$ having class number one, or equivalently that all positive-definite integer binary quadratic forms of discriminant $-163$ are equivalent.

Added I'll try to explain the connection with binary quadratic forms. Consider a quadratic form $$Q(x,y)=ax^2+bxy+cy^2$$ with $a$, $b$ and $c$ integers. I'll only consider forms $Q$ which are primitive, so that $a$, $b$ and $c$ have no common factor $ > 1$, and positive-definite, that is $a > 0$ and the discriminant $D=b^2-4ac < 0$. There is a notion of equivalence of quadratic forms, and two primitive positive-definite forms $Q$ and $Q'(x,y)=a'x^2+b'xy+c'y^2$ (necessarily also of discriminant $D$) are equivalent if and only if $$j\left(\frac{b+\sqrt{-D}}{2a}\right) =j\left(\frac{b'+\sqrt{-D}}{2a'}\right).$$ For each possible discriminant there are only finitely many equivalence classes. Thus we get a finite set of $j$-values for each discriminant, and the big theorem is that they are the solutions of a monic algebraic equation with integer coefficients. When there is only one class the equation has the form $x-k=0$ where $x$ is an integer, and the $j$-value must be an integer.

My recommended reference for this is David Cox's book Primes of the form $x^2+ny^2$. But these results appear towards the end of this 350-page book.

Robin Chapman
  • 21,512
  • 2
  • 59
  • 78
  • 4
    Related to this are the Heegner numbers: http://mathworld.wolfram.com/HeegnerNumber.html – J. M. ain't a mathematician Sep 13 '10 at 16:15
  • Worth adding that $163$ is the largest number having this property. That $e^{\pi\sqrt{43}}$ is within $10^{-3}$ of an integer, $e^{\pi\sqrt{67}}$ is with $10^{-6}$ if an integer, but $163$ gets us within $10^{-12}$ of an integer. The values smaller than $43$ don't get us appreciably close to integer values, however.\ – Thomas Andrews Jul 10 '21 at 19:56

I do not think "why" has a reasonable layman's-terms answer, but let me at least explain "how" with a simpler example of such a numerical coincidence. If one takes powers of the golden ratio $\phi = \frac{1 + \sqrt{5}}{2}$ it is not hard to see that they are close to integers. For example, $\phi^{20} = 15126.999934...$. One might ask an analogous question about why these numbers are close to integers. The answer is that

$$\phi^n + \varphi^n = L_n$$

where $L_n$ is the $n^{th}$ Lucas number (an integer), and where $\varphi = \frac{1 - \sqrt{5}}{2}$ has absolute value less than $1$. As $n$ gets larger, $\varphi^n$ gets smaller, so $\phi^n$ becomes a better and better approximation to the integer $L_n$.

A similar, but much more complicated, phenomenon is happening here. The reason $e^{\pi \sqrt{163}}$ is so close to an integer is that it, plus a small error term, gives a special formula for that integer. But "why" this formula exists is a rather long and complicated story (as Robin Chapman hints at) and I do not think there is any reasonable way to talk about it in layman's terms.

Qiaochu Yuan
  • 359,788
  • 42
  • 777
  • 1,145
  • 2
    For a generalization of the above example, see http://en.wikipedia.org/wiki/Pisot%E2%80%93Vijayaraghavan_number . – Qiaochu Yuan Sep 13 '10 at 18:02
  • accepted as answer for explaining how some numbers approach integers, albeit with a completely different example. I understand Rumanujan's Constant is way beyond my understanding of mathematics. – stevenvh Sep 14 '10 at 14:56
  • 2
    The above explanation is not correct. The approximation property of powers of the golden ratio are due to the fact that it is a Pisot number, i.e., it is > 1 and all its conjugates have absolute value < 1. While interesting, it has applications to Fourier analysis, the Salem-Zygmund theorem characterizing a class of sets of uniqueness, this is not at all what is going on here. – ilan vardi Jul 17 '13 at 11:53
  • 9
    @ilan: I never claimed that it was. I claimed that it was *similar* (in that there is a formula for an integer which has a bulk term and a small error term). – Qiaochu Yuan Jul 17 '13 at 19:08

As QY pointed out this cannot be explained in layman terms: Here are the papers which you would like to see: www.isibang.ac.in/~sury/ramanujanday.pdf


  • 3
    Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Guy Apr 01 '14 at 05:30

I know it's super late but in case anyone has this question in the future, Richard Borcherds made a really digestible video on it in 2020: https://www.youtube.com/watch?v=a9k_QmZbwX8&list=PLar4u0v66vIodqt3KSZPsYyuULD5meoAo&index=85

  • 350
  • 1
  • 11