17
$\begingroup$

According to this Wikipedia article $\pi$ is approximately 3.243F in base 16 (i.e. hexadecimal).

Can someone explain this? (Note: I understand how to convert an integer to base 16)

Thanks

$\endgroup$
5
  • 5
    $\begingroup$ How to convert to base 16: In base $16$ we have (by definition) $\pi = 3 + \sum_{n=1}^\infty \frac{a_n}{16^n}$. From this it follows that $a_1 = \lfloor(\pi-3)16\rfloor$, $a_2 = \lfloor(\pi -3 - a_1/16)16^2\rfloor$, and so on $\endgroup$
    – Winther
    Apr 12, 2015 at 19:48
  • 15
    $\begingroup$ This means $\pi$ is approximately $$3+\frac{2}{16}+\frac{4}{16^2}+\frac{3}{16^3}+\frac{15}{16^4}$$ $\endgroup$ Apr 12, 2015 at 19:49
  • $\begingroup$ Ohh. Got it. Thanks! $\endgroup$
    – Ben
    Apr 12, 2015 at 19:49
  • $\begingroup$ In case you are not only interested in converting any number to base 16, the Bailey-Borwein-Plouffe formula (to compute Pi) might be worth a look, since it works on base 16 :-) Oh - now I've seen that @azimut has told exactly this formula. $\endgroup$
    – tueftl
    Apr 13, 2015 at 7:58
  • $\begingroup$ In practice you typically do it the other way round. You compute pi in binary/hex and then convert it to decimal. $\endgroup$ Apr 13, 2015 at 10:14

3 Answers 3

34
$\begingroup$

One way to convert any decimal fraction to base $16$ is as follows (taking $\pi$ as an example).$$\pi=\color{blue}3.141592...$$

Take the whole number part and convert it to base $16$ as usual. In this case $\color{blue}3$ will remain as $3$. So we have so far got $3.14159..._{10}=\color{red}{3...._{16}}$

This now leaves us with $0.141592...$ - Multiply this by our new base to get $$\color{red}{16}\times0.14159...=\color{blue}2.26544...$$Now again convert the whole number part to our new base as usual - in this case the $\color{blue}2$ remains as a $2$. So we have so far got $3.14159..._{10}=\color{red}{3.2..._{16}}$

This now leaves us with $0.26544...$ - Multiply this by our new base to get $$\color{red}{16}\times0.26544...=\color{blue}4.24704...$$Now again convert the whole number part to our new base as usual - in this case the $\color{blue}4$ remains as a $4$. So we have so far got $3.14159..._{10}=\color{red}{3.24..._{16}}$

This now leaves us with $0.24704...$ - Multiply this by our new base to get $$\color{red}{16}\times0.24704...=\color{blue}3.95264...$$Now again convert the whole number part to our new base as usual - in this case the $\color{blue}3$ remains as a $3$. So we have so far got $3.14159..._{10}=\color{red}{3.243..._{16}}$

You can continue this process for as many digits as you require.

$\endgroup$
13
$\begingroup$

Note that: $$10000\pi=31415.92653\dots$$ which means that the decimal version of $\pi$ begins $3.1415\dots$.

Similarly: $$16^4\pi=205887.46145\dots$$ Since $205887$ is $3243F$ in hexadecimal, the hexadecimal version begins $3.243F\dots$.

$\endgroup$
13
$\begingroup$

For the particular base of $16$, there is this remarkable formula: $$\pi=\sum_{n=0}^\infty \left(\frac{4}{8n+1}-\frac{2}{8n+4}-\frac{1}{8n+5}-\frac{1}{8n+6}\right)\frac{1}{16^n}$$ It allows the computation of any base 16 digit of $\pi$ without the need to compute all the preceding digits.

The discovery of this formula by Bailey, Borwein and Plouffe in 1995 came as a big surprise, as it was conjectured that no such formula can exist.

$\endgroup$
6
  • $\begingroup$ weird, for $n=0$ i don't get a $3$ that is the first digit in base $16$. Is this formula correct? $\endgroup$
    – Héctor
    Apr 13, 2015 at 2:04
  • 2
    $\begingroup$ @Héctor According to this source finding the nth digit is possible with this, but it is not as straighforward as plugging a certain n into this formula. $\endgroup$
    – Jos
    Apr 13, 2015 at 6:45
  • $\begingroup$ As @Jos already pointed the correct link, the name of this formula should be told: Bailey-Borwein-Plouffe formula. $\endgroup$
    – tueftl
    Apr 13, 2015 at 8:02
  • $\begingroup$ @tueftl: ok, I've added the names and a link to the wikipedia page. $\endgroup$
    – azimut
    Apr 13, 2015 at 9:31
  • 2
    $\begingroup$ The really extraordinary of the formula BBP is the history fact that before it everybody though that the calcul of an irrational must be step by step, that was impossible to determine any digit of position n, say, whitouh determine the precedent digits. (sorry by my ugly english. $\endgroup$
    – Piquito
    Apr 13, 2015 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .