[  Home -- Blog -- Reference -- About  ]


Permutation Fractions
---------------------
355/133 is a  famous  fractional apporo-
ximation of PI.  It is roughly  equal to
3.1415929.., extremely close to the true
value 3.141592653589... However, it only
uses three of  the available decimal di-
gits, and it uses them three times each!
How close can we get if we restrict both
the numerator and denominator to use all
digits 1-9, one time each?

Given that there are 9! = 352880 possib-
le numerators, and as many denominators,
this is very brute-forcable. A quick and
dirty  python script  was able to calcu-
late optimal fractions  using the digits
1 to 7  in a few seconds,  1 to 8 took a
few minutes,  and letting  it run  over-
night,  took care of the final case (for
no reason at all, I didn't think of inc-
luding zero in any of this).

Results
-------
Digs | Best fraction      | PI
1    | 1 / 1              | 1.0
1-2  | 21 / 12            | 1.75
1-3  | 321 / 123          | 2.60...
1-4  | 4213 / 1342        | 3.139...
1-5  | 42531 / 13542      | 3.1406...
1-6  | 516243 / 164325    | 3.141597...
1-7  | 6734215 / 2143567  | 3.1415929...

Using digits 1-8 gives the optimal frac-
tion:

87435126 / 27831465 = 3.1415926542...

with an impressive eight correct decimal
places!

And finally, all digits 1-9 gives:

467895213 / 148935672 = 3.14159265350...

with ten correct decimals.


Addendum
--------
A similar constraint is to only use each
digit  once,  across both the  numerator
and  the denominator.  This gives a much
simpler brute force problem,  so solving
that took  my dirty python  code no time
at all.  This time I  even remembered to
include zero!

The optimal fraction in this case is:

85910 / 27346 = 3.1415929203...

Coincidentally, this actually reduces to
the "standard" fractional approximation,
355/113!


Use this information for whatever purpo-
se you might find for it!


v > Discussion No comments yet. == Add a Comment ==
[ Home -- Blog -- Reference -- About ] ---------------------------------------- 99v.no (c)2026