Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
Why did I think of that?

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.

user:
pass:
register,


       

PI fractions

a small program for finding fractional representations of pi
 
(0)
  [vote for,
against]

To 15 decimal places of accuracy, the mathematical constant known as "pi", the ratio of a circle's circumference to its diameter, is 3.141592653589793 (the next digit is a "2" so that last "3" is not a rounded-up value).

Thousands of years ago it was noticed that pi was not exactly equal to 3, and that the fraction 22/7 was a reasonable approximation (off by about one part in a thousand).

In the Middle Ages it was discovered that the fraction 355/113 was a much better approximation (off by about three parts in ten million).

I wondered about what other fractions might be decent approximations of pi. Here's a computer program (in QBASIC) I wote to find some:

DIM a AS DOUBLE, b AS DOUBLE, c AS DOUBLE
DIM d AS DOUBLE, e AS DOUBLE, f AS LONG
CLS
a = 3.141592653589793# 'max accuracy QBASIC allows
e = 1# 'current level of accuracy-of-computation
FOR f = 1 TO 20000000 'twenty million loops
b = FIX((f * a) + .01) 'compute numerator if 'f' is denominator
c = b / f 'compute the fraction
d = c - a 'get difference between this fraction and pi
IF (d < 0) THEN 'not trusting the ABS() function here
d = -d 'get absolute value of the difference
END IF
IF (d < e) THEN 'is current fraction a better approximation of pi?
e = d 'save that smaller difference for next comparison
PRINT b; f, c
END IF
NEXT f

Here are the results:
3 / 1 -------- 3
22 / 7 -------- 3.142857142857143
179 / 57 ------- 3.140350877192982
201 / 64 ------- 3.140625
223 / 71 ------- 3.140845070422535
245 / 78 ------- 3.141025641025641
267 / 85 ------- 3.141176470588235
289 / 92 ------- 3.141304347826087
311 / 99 ------- 3.141414141414141
333 / 106 ------ 3.141509433962264
355 / 113 ------ 3.141592920353983
52163 / 16604 ---- 3.141592387376536
52518 / 16717 ---- 3.141592390979242
52873 / 16830 ---- 3.141592394533571
53228 / 16943 ---- 3.141592398040489
53583 / 17056 ---- 3.141592401500938
53938 / 17169 ---- 3.141592404915837
54293 / 17282 ---- 3.141592408286078
54648 / 17395 ---- 3.141592411612532
55003 / 17508 ---- 3.141592414896047
55358 / 17621 ---- 3.14159241813745
55713 / 17734 ---- 3.141592421337544
56068 / 17847 ---- 3.141592424497115
56423 / 17960 ---- 3.141592427616926
56778 / 18073 ---- 3.141592430697726
57133 / 18186 ---- 3.14159243374024
57488 / 18299 ---- 3.141592436745178
57843 / 18412 ---- 3.14159243971323
58198 / 18525 ---- 3.141592442645074
58553 / 18638 ---- 3.141592445541367
58908 / 18751 ---- 3.141592448402752
59263 / 18864 ---- 3.141592451229856
59618 / 18977 ---- 3.141592454023292
59973 / 19090 ---- 3.141592456783656
60328 / 19203 ---- 3.141592459511535
60683 / 19316 ---- 3.141592462207496
61038 / 19429 ---- 3.141592464872098
61393 / 19542 ---- 3.141592467505885
61748 / 19655 ---- 3.141592470109387
62103 / 19768 ---- 3.141592472683124
62458 / 19881 ---- 3.141592475227604
62813 / 19994 ---- 3.141592477743323
63168 / 20107 ---- 3.141592480230766
63523 / 20220 ---- 3.141592482690406
63878 / 20333 ---- 3.141592485122707
64233 / 20446 ---- 3.141592487528123
64588 / 20559 ---- 3.141592489907097
64943 / 20672 ---- 3.141592492260062
65298 / 20785 ---- 3.141592494587443
65653 / 20898 ---- 3.141592496889654
66008 / 21011 ---- 3.141592499167103
66363 / 21124 ---- 3.141592501420186
66718 / 21237 ---- 3.141592503649291
67073 / 21350 ---- 3.141592505854801
67428 / 21463 ---- 3.141592508037087
67783 / 21576 ---- 3.141592510196515
68138 / 21689 ---- 3.141592512333441
68493 / 21802 ---- 3.141592514448216
68848 / 21915 ---- 3.141592516541182
69203 / 22028 ---- 3.141592518612675
69558 / 22141 ---- 3.141592520663024
69913 / 22254 ---- 3.14159252269255
70268 / 22367 ---- 3.141592524701569
70623 / 22480 ---- 3.141592526690391
70978 / 22593 ---- 3.141592528659319
71333 / 22706 ---- 3.14159253060865
71688 / 22819 ---- 3.141592532538674
72043 / 22932 ---- 3.141592534449677
72398 / 23045 ---- 3.141592536341939
72753 / 23158 ---- 3.141592538215735
73108 / 23271 ---- 3.141592540071334
73463 / 23384 ---- 3.141592541908997
73818 / 23497 ---- 3.141592543728987
74173 / 23610 ---- 3.141592545531554
74528 / 23723 ---- 3.14159254731695
74883 / 23836 ---- 3.141592549085417
75238 / 23949 ---- 3.141592550837196
75593 / 24062 ---- 3.141592552572521
75948 / 24175 ---- 3.141592554291623
76303 / 24288 ---- 3.14159255599473
76658 / 24401 ---- 3.141592557682062
77013 / 24514 ---- 3.141592559353839
77368 / 24627 ---- 3.141592561010273
77723 / 24740 ---- 3.141592562651577
78078 / 24853 ---- 3.141592564277954
78433 / 24966 ---- 3.14159256588961
78788 / 25079 ---- 3.141592567486742
79143 / 25192 ---- 3.141592569069546
79498 / 25305 ---- 3.141592570638214
79853 / 25418 ---- 3.141592572192934
80208 / 25531 ---- 3.141592573733892
80563 / 25644 ---- 3.14159257526127
80918 / 25757 ---- 3.141592576775246
81273 / 25870 ---- 3.141592578275995
81628 / 25983 ---- 3.141592579763691
81983 / 26096 ---- 3.141592581238504
82338 / 26209 ---- 3.141592582700599
82693 / 26322 ---- 3.14159258415014
83048 / 26435 ---- 3.141592585587289
83403 / 26548 ---- 3.141592587012204
83758 / 26661 ---- 3.14159258842504
84113 / 26774 ---- 3.14159258982595
84468 / 26887 ---- 3.141592591215085
84823 / 27000 ---- 3.141592592592592
85178 / 27113 ---- 3.141592593958618
85533 / 27226 ---- 3.141592595313303
85888 / 27339 ---- 3.141592596656791
86243 / 27452 ---- 3.141592597989217
86598 / 27565 ---- 3.14159259931072
86953 / 27678 ---- 3.141592600621432
87308 / 27791 ---- 3.141592601921485
87663 / 27904 ---- 3.141592603211009
88018 / 28017 ---- 3.141592604490131
88373 / 28130 ---- 3.141592605758976
88728 / 28243 ---- 3.141592607017668
89083 / 28356 ---- 3.141592608266328
89438 / 28469 ---- 3.141592609505076
89793 / 28582 ---- 3.141592610734028
90148 / 28695 ---- 3.141592611953302
90503 / 28808 ---- 3.14159261316301
90858 / 28921 ---- 3.141592614363265
91213 / 29034 ---- 3.141592615554178
91568 / 29147 ---- 3.141592616735856
91923 / 29260 ---- 3.141592617908407
92278 / 29373 ---- 3.141592619071937
92633 / 29486 ---- 3.141592620226548
92988 / 29599 ---- 3.141592621372344
93343 / 29712 ---- 3.141592622509424
93698 / 29825 ---- 3.141592623637888
94053 / 29938 ---- 3.141592624757833
94408 / 30051 ---- 3.141592625869356
94763 / 30164 ---- 3.14159262697255
95118 / 30277 ---- 3.14159262806751
95473 / 30390 ---- 3.141592629154327
95828 / 30503 ---- 3.141592630233092
96183 / 30616 ---- 3.141592631303893
96538 / 30729 ---- 3.14159263236682
96893 / 30842 ---- 3.141592633421957
97248 / 30955 ---- 3.141592634469391
97603 / 31068 ---- 3.141592635509205
97958 / 31181 ---- 3.141592636541484
98313 / 31294 ---- 3.141592637566307
98668 / 31407 ---- 3.141592638583755
99023 / 31520 ---- 3.141592639593909
99378 / 31633 ---- 3.141592640596845
99733 / 31746 ---- 3.141592641592641
100088 / 31859 ---- 3.141592642581374
100443 / 31972 ---- 3.141592643563118
100798 / 32085 ---- 3.141592644537946
101153 / 32198 ---- 3.141592645505932
101508 / 32311 ---- 3.141592646467148
101863 / 32424 ---- 3.141592647421663
102218 / 32537 ---- 3.141592648369548
102573 / 32650 ---- 3.141592649310873
102928 / 32763 ---- 3.141592650245704
103283 / 32876 ---- 3.141592651174109
103638 / 32989 ---- 3.141592652096153
103993 / 33102 ---- 3.141592653011902
104348 / 33215 ---- 3.141592653921421
208341 / 66317 ---- 3.141592653467437
312689 / 99532 ---- 3.141592653618936
833719 / 265381 --- 3.141592653581078
1146408 / 364913 --- 3.141592653591404
3126535 / 995207 --- 3.14159265358865
4272943 / 1360120 -- 3.141592653589389
5419351 / 1725033 -- 3.141592653589815
42208400 / 13435351 - 3.141592653589772
47627751 / 15160384 - 3.141592653589777
53047102 / 16885417 - 3.141592653589781
58466453 / 18610450 - 3.141592653589784

It appears that 355/113 is the best simple fractional approximation of pi to remember. It's also easy to remember, if you think of the sequence 113355, then split the sequence in half and divide the first half into the second half.

For any of those "better" fractions, you would have to memorize almost as many total-number-of digits as if you decided to memorize the actual decimal version itself: 3.14159265358979323846...

Vernon, Jan 15 2011

Continued fractions http://www.petrospe...kommer/contfrac.htm
Another algorithm for generating rational approximations [Wrongfellow, Jan 15 2011]

[link]






       That's a very brute-force approach. Continued fractions will get you the really good approximations more quickly than that - see the link, which discusses pi towards the end of the page.
Wrongfellow, Jan 15 2011
  

       //I wondered about what other fractions might be decent approximations of pi//   

       I'm reasonably sure that others have wondered this too...
Jinbish, Jan 15 2011
  
      
[annotate]
  


 

back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle