megamaz

Pi Rational Approximations

Mar 31st, 2025
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.06 KB | Science | 0 0
  1. New better approximation found: 1/1 = 1.0, approximating 3.141592653589793 (error=2.141592653589793)
  2. New better approximation found: 2/1 = 2.0, approximating 3.141592653589793 (error=1.1415926535897931)
  3. New better approximation found: 3/1 = 3.0, approximating 3.141592653589793 (error=0.14159265358979312)
  4. New better approximation found: 13/4 = 3.25, approximating 3.141592653589793 (error=0.10840734641020688)
  5. New better approximation found: 16/5 = 3.2, approximating 3.141592653589793 (error=0.05840734641020706)
  6. New better approximation found: 19/6 = 3.1666666666666665, approximating 3.141592653589793 (error=0.025074013076873403)
  7. New better approximation found: 22/7 = 3.142857142857143, approximating 3.141592653589793 (error=0.0012644892673496777)
  8. New better approximation found: 179/57 = 3.1403508771929824, approximating 3.141592653589793 (error=0.0012417763968106676)
  9. New better approximation found: 201/64 = 3.140625, approximating 3.141592653589793 (error=0.000967653589793116)
  10. New better approximation found: 223/71 = 3.140845070422535, approximating 3.141592653589793 (error=0.0007475831672580924)
  11. New better approximation found: 245/78 = 3.141025641025641, approximating 3.141592653589793 (error=0.0005670125641521473)
  12. New better approximation found: 267/85 = 3.1411764705882352, approximating 3.141592653589793 (error=0.00041618300155787935)
  13. New better approximation found: 289/92 = 3.141304347826087, approximating 3.141592653589793 (error=0.0002883057637061981)
  14. New better approximation found: 311/99 = 3.1414141414141414, approximating 3.141592653589793 (error=0.00017851217565167943)
  15. New better approximation found: 333/106 = 3.141509433962264, approximating 3.141592653589793 (error=8.32196275291075e-05)
  16. New better approximation found: 355/113 = 3.1415929203539825, approximating 3.141592653589793 (error=2.667641894049666e-07)
  17. New better approximation found: 52163/16604 = 3.141592387376536, approximating 3.141592653589793 (error=2.662132572162079e-07)
  18. New better approximation found: 52518/16717 = 3.1415923909792425, approximating 3.141592653589793 (error=2.6261055063869776e-07)
  19. New better approximation found: 52873/16830 = 3.141592394533571, approximating 3.141592653589793 (error=2.5905622225153024e-07)
  20. New better approximation found: 53228/16943 = 3.1415923980404887, approximating 3.141592653589793 (error=2.555493043843171e-07)
  21. New better approximation found: 53583/17056 = 3.141592401500938, approximating 3.141592653589793 (error=2.5208885512384427e-07)
  22. New better approximation found: 53938/17169 = 3.1415924049158366, approximating 3.141592653589793 (error=2.4867395653771496e-07)
  23. New better approximation found: 54293/17282 = 3.141592408286078, approximating 3.141592653589793 (error=2.4530371511843896e-07)
  24. New better approximation found: 54648/17395 = 3.141592411612532, approximating 3.141592653589793 (error=2.419772608952542e-07)
  25. New better approximation found: 55003/17508 = 3.1415924148960475, approximating 3.141592653589793 (error=2.386937456577698e-07)
  26. New better approximation found: 55358/17621 = 3.1415924181374497, approximating 3.141592653589793 (error=2.354523434000555e-07)
  27. New better approximation found: 55713/17734 = 3.1415924213375437, approximating 3.141592653589793 (error=2.3225224943246303e-07)
  28. New better approximation found: 56068/17847 = 3.1415924244971145, approximating 3.141592653589793 (error=2.2909267860526938e-07)
  29. New better approximation found: 56423/17960 = 3.1415924276169265, approximating 3.141592653589793 (error=2.259728666409444e-07)
  30. New better approximation found: 56778/18073 = 3.141592430697726, approximating 3.141592653589793 (error=2.2289206702552633e-07)
  31. New better approximation found: 57133/18186 = 3.14159243374024, approximating 3.141592653589793 (error=2.1984955322906785e-07)
  32. New better approximation found: 57488/18299 = 3.1415924367451775, approximating 3.141592653589793 (error=2.1684461559701163e-07)
  33. New better approximation found: 57843/18412 = 3.1415924397132304, approximating 3.141592653589793 (error=2.1387656268245792e-07)
  34. New better approximation found: 58198/18525 = 3.141592442645074, approximating 3.141592653589793 (error=2.1094471902571854e-07)
  35. New better approximation found: 58553/18638 = 3.141592445541367, approximating 3.141592653589793 (error=2.080484260424953e-07)
  36. New better approximation found: 58908/18751 = 3.141592448402752, approximating 3.141592653589793 (error=2.0518704113570152e-07)
  37. New better approximation found: 59263/18864 = 3.141592451229856, approximating 3.141592653589793 (error=2.023599372513729e-07)
  38. New better approximation found: 59618/18977 = 3.1415924540232916, approximating 3.141592653589793 (error=1.9956650154639988e-07)
  39. New better approximation found: 59973/19090 = 3.1415924567836564, approximating 3.141592653589793 (error=1.9680613672079517e-07)
  40. New better approximation found: 60328/19203 = 3.1415924595115348, approximating 3.141592653589793 (error=1.9407825835315862e-07)
  41. New better approximation found: 60683/19316 = 3.1415924622074964, approximating 3.141592653589793 (error=1.91382296677034e-07)
  42. New better approximation found: 61038/19429 = 3.1415924648720983, approximating 3.141592653589793 (error=1.8871769480455214e-07)
  43. New better approximation found: 61393/19542 = 3.141592467505885, approximating 3.141592653589793 (error=1.8608390828234178e-07)
  44. New better approximation found: 61748/19655 = 3.141592470109387, approximating 3.141592653589793 (error=1.8348040597970794e-07)
  45. New better approximation found: 62103/19768 = 3.1415924726831244, approximating 3.141592653589793 (error=1.809066687563643e-07)
  46. New better approximation found: 62458/19881 = 3.141592475227604, approximating 3.141592653589793 (error=1.78362189018344e-07)
  47. New better approximation found: 62813/19994 = 3.141592477743323, approximating 3.141592653589793 (error=1.7584647027391043e-07)
  48. New better approximation found: 63168/20107 = 3.1415924802307655, approximating 3.141592653589793 (error=1.7335902757764643e-07)
  49. New better approximation found: 63523/20220 = 3.1415924826904056, approximating 3.141592653589793 (error=1.708993875304543e-07)
  50. New better approximation found: 63878/20333 = 3.141592485122707, approximating 3.141592653589793 (error=1.6846708605910976e-07)
  51. New better approximation found: 64233/20446 = 3.141592487528123, approximating 3.141592653589793 (error=1.6606167019261875e-07)
  52. New better approximation found: 64588/20559 = 3.141592489907097, approximating 3.141592653589793 (error=1.6368269628586063e-07)
  53. New better approximation found: 64943/20672 = 3.1415924922600618, approximating 3.141592653589793 (error=1.613297313518558e-07)
  54. New better approximation found: 65298/20785 = 3.1415924945874427, approximating 3.141592653589793 (error=1.5900235039723043e-07)
  55. New better approximation found: 65653/20898 = 3.1415924968896545, approximating 3.141592653589793 (error=1.5670013864266252e-07)
  56. New better approximation found: 66008/21011 = 3.141592499167103, approximating 3.141592653589793 (error=1.5442269019061428e-07)
  57. New better approximation found: 66363/21124 = 3.1415925014201855, approximating 3.141592653589793 (error=1.5216960758124287e-07)
  58. New better approximation found: 66718/21237 = 3.1415925036492913, approximating 3.141592653589793 (error=1.4994050179240048e-07)
  59. New better approximation found: 67073/21350 = 3.141592505854801, approximating 3.141592653589793 (error=1.4773499223963427e-07)
  60. New better approximation found: 67428/21463 = 3.1415925080370872, approximating 3.141592653589793 (error=1.4555270588800795e-07)
  61. New better approximation found: 67783/21576 = 3.1415925101965145, approximating 3.141592653589793 (error=1.4339327858436945e-07)
  62. New better approximation found: 68138/21689 = 3.1415925123334407, approximating 3.141592653589793 (error=1.4125635239281564e-07)
  63. New better approximation found: 68493/21802 = 3.1415925144482157, approximating 3.141592653589793 (error=1.3914157737104915e-07)
  64. New better approximation found: 68848/21915 = 3.141592516541182, approximating 3.141592653589793 (error=1.370486111262892e-07)
  65. New better approximation found: 69203/22028 = 3.1415925186126747, approximating 3.141592653589793 (error=1.3497711837118231e-07)
  66. New better approximation found: 69558/22141 = 3.1415925206630235, approximating 3.141592653589793 (error=1.3292676959153482e-07)
  67. New better approximation found: 69913/22254 = 3.14159252269255, approximating 3.141592653589793 (error=1.3089724326675878e-07)
  68. New better approximation found: 70268/22367 = 3.1415925247015695, approximating 3.141592653589793 (error=1.2888822364942598e-07)
  69. New better approximation found: 70623/22480 = 3.1415925266903915, approximating 3.141592653589793 (error=1.2689940165344638e-07)
  70. New better approximation found: 70978/22593 = 3.141592528659319, approximating 3.141592653589793 (error=1.2493047396588963e-07)
  71. New better approximation found: 71333/22706 = 3.1415925306086496, approximating 3.141592653589793 (error=1.2298114349107436e-07)
  72. New better approximation found: 71688/22819 = 3.1415925325386738, approximating 3.141592653589793 (error=1.2105111935056811e-07)
  73. New better approximation found: 72043/22932 = 3.141592534449677, approximating 3.141592653589793 (error=1.1914011599500895e-07)
  74. New better approximation found: 72398/23045 = 3.1415925363419395, approximating 3.141592653589793 (error=1.1724785364819468e-07)
  75. New better approximation found: 72753/23158 = 3.1415925382157353, approximating 3.141592653589793 (error=1.153740578629936e-07)
  76. New better approximation found: 73108/23271 = 3.1415925400713336, approximating 3.141592653589793 (error=1.1351845952134454e-07)
  77. New better approximation found: 73463/23384 = 3.1415925419089974, approximating 3.141592653589793 (error=1.1168079572243528e-07)
  78. New better approximation found: 73818/23497 = 3.141592543728987, approximating 3.141592653589793 (error=1.0986080622998884e-07)
  79. New better approximation found: 74173/23610 = 3.1415925455315543, approximating 3.141592653589793 (error=1.0805823880133403e-07)
  80. New better approximation found: 74528/23723 = 3.1415925473169497, approximating 3.141592653589793 (error=1.062728434142457e-07)
  81. New better approximation found: 74883/23836 = 3.141592549085417, approximating 3.141592653589793 (error=1.0450437626374764e-07)
  82. New better approximation found: 75238/23949 = 3.1415925508371956, approximating 3.141592653589793 (error=1.0275259754166655e-07)
  83. New better approximation found: 75593/24062 = 3.141592552572521, approximating 3.141592653589793 (error=1.0101727232481039e-07)
  84. New better approximation found: 75948/24175 = 3.1415925542916234, approximating 3.141592653589793 (error=9.929816968679006e-08)
  85. New better approximation found: 76303/24288 = 3.14159255599473, approximating 3.141592653589793 (error=9.759506314210853e-08)
  86. New better approximation found: 76658/24401 = 3.141592557682062, approximating 3.141592653589793 (error=9.590773109025008e-08)
  87. New better approximation found: 77013/24514 = 3.1415925593538385, approximating 3.141592653589793 (error=9.423595459523426e-08)
  88. New better approximation found: 77368/24627 = 3.141592561010273, approximating 3.141592653589793 (error=9.257952005015113e-08)
  89. New better approximation found: 77723/24740 = 3.1415925626515766, approximating 3.141592653589793 (error=9.093821651262601e-08)
  90. New better approximation found: 78078/24853 = 3.1415925642779543, approximating 3.141592653589793 (error=8.931183881344396e-08)
  91. New better approximation found: 78433/24966 = 3.14159256588961, approximating 3.141592653589793 (error=8.770018311565764e-08)
  92. New better approximation found: 78788/25079 = 3.1415925674867418, approximating 3.141592653589793 (error=8.610305135547947e-08)
  93. New better approximation found: 79143/25192 = 3.141592569069546, approximating 3.141592653589793 (error=8.452024724547869e-08)
  94. New better approximation found: 79498/25305 = 3.1415925706382137, approximating 3.141592653589793 (error=8.295157938320585e-08)
  95. New better approximation found: 79853/25418 = 3.141592572192934, approximating 3.141592653589793 (error=8.139685903074678e-08)
  96. New better approximation found: 80208/25531 = 3.141592573733892, approximating 3.141592653589793 (error=7.985590100290096e-08)
  97. New better approximation found: 80563/25644 = 3.14159257526127, approximating 3.141592653589793 (error=7.832852322309236e-08)
  98. New better approximation found: 80918/25757 = 3.1415925767752455, approximating 3.141592653589793 (error=7.681454761154782e-08)
  99. New better approximation found: 81273/25870 = 3.1415925782759953, approximating 3.141592653589793 (error=7.531379786485104e-08)
  100. New better approximation found: 81628/25983 = 3.1415925797636914, approximating 3.141592653589793 (error=7.382610167638859e-08)
  101. New better approximation found: 81983/26096 = 3.141592581238504, approximating 3.141592653589793 (error=7.23512889599931e-08)
  102. New better approximation found: 82338/26209 = 3.141592582700599, approximating 3.141592653589793 (error=7.08891940703893e-08)
  103. New better approximation found: 82693/26322 = 3.1415925841501404, approximating 3.141592653589793 (error=6.943965269456953e-08)
  104. New better approximation found: 83048/26435 = 3.1415925855872895, approximating 3.141592653589793 (error=6.800250362815063e-08)
  105. New better approximation found: 83403/26548 = 3.1415925870122043, approximating 3.141592653589793 (error=6.65775887753739e-08)
  106. New better approximation found: 83758/26661 = 3.1415925884250404, approximating 3.141592653589793 (error=6.516475270501587e-08)
  107. New better approximation found: 84113/26774 = 3.1415925898259505, approximating 3.141592653589793 (error=6.376384265038837e-08)
  108. New better approximation found: 84468/26887 = 3.1415925912150855, approximating 3.141592653589793 (error=6.237470762116004e-08)
  109. New better approximation found: 84823/27000 = 3.1415925925925925, approximating 3.141592653589793 (error=6.099720062380243e-08)
  110. New better approximation found: 85178/27113 = 3.1415925939586176, approximating 3.141592653589793 (error=5.963117555296549e-08)
  111. New better approximation found: 85533/27226 = 3.1415925953133033, approximating 3.141592653589793 (error=5.827648985601286e-08)
  112. New better approximation found: 85888/27339 = 3.141592596656791, approximating 3.141592653589793 (error=5.693300231257581e-08)
  113. New better approximation found: 86243/27452 = 3.1415925979892174, approximating 3.141592653589793 (error=5.5600575699088495e-08)
  114. New better approximation found: 86598/27565 = 3.1415925993107203, approximating 3.141592653589793 (error=5.427907279198507e-08)
  115. New better approximation found: 86953/27678 = 3.1415926006214323, approximating 3.141592653589793 (error=5.29683608085918e-08)
  116. New better approximation found: 87308/27791 = 3.1415926019214853, approximating 3.141592653589793 (error=5.166830785441334e-08)
  117. New better approximation found: 87663/27904 = 3.1415926032110093, approximating 3.141592653589793 (error=5.037878381131122e-08)
  118. New better approximation found: 88018/28017 = 3.141592604490131, approximating 3.141592653589793 (error=4.909966211386063e-08)
  119. New better approximation found: 88373/28130 = 3.141592605758976, approximating 3.141592653589793 (error=4.783081708481518e-08)
  120. New better approximation found: 88728/28243 = 3.1415926070176683, approximating 3.141592653589793 (error=4.657212482328532e-08)
  121. New better approximation found: 89083/28356 = 3.141592608266328, approximating 3.141592653589793 (error=4.5323464981095185e-08)
  122. New better approximation found: 89438/28469 = 3.141592609505076, approximating 3.141592653589793 (error=4.40847172100689e-08)
  123. New better approximation found: 89793/28582 = 3.1415926107340284, approximating 3.141592653589793 (error=4.285576471474428e-08)
  124. New better approximation found: 90148/28695 = 3.141592611953302, approximating 3.141592653589793 (error=4.1636491143748344e-08)
  125. New better approximation found: 90503/28808 = 3.1415926131630103, approximating 3.141592653589793 (error=4.042678281024337e-08)
  126. New better approximation found: 90858/28921 = 3.1415926143632653, approximating 3.141592653589793 (error=3.922652780374847e-08)
  127. New better approximation found: 91213/29034 = 3.141592615554178, approximating 3.141592653589793 (error=3.8035615101961184e-08)
  128. New better approximation found: 91568/29147 = 3.1415926167358563, approximating 3.141592653589793 (error=3.685393679120352e-08)
  129. New better approximation found: 91923/29260 = 3.1415926179084073, approximating 3.141592653589793 (error=3.568138584597591e-08)
  130. New better approximation found: 92278/29373 = 3.141592619071937, approximating 3.141592653589793 (error=3.451785612895719e-08)
  131. New better approximation found: 92633/29486 = 3.141592620226548, approximating 3.141592653589793 (error=3.336324505553989e-08)
  132. New better approximation found: 92988/29599 = 3.1415926213723435, approximating 3.141592653589793 (error=3.2217449597027326e-08)
  133. New better approximation found: 93343/29712 = 3.1415926225094237, approximating 3.141592653589793 (error=3.108036938925807e-08)
  134. New better approximation found: 93698/29825 = 3.1415926236378877, approximating 3.141592653589793 (error=2.995190540033832e-08)
  135. New better approximation found: 94053/29938 = 3.1415926247578327, approximating 3.141592653589793 (error=2.8831960374731125e-08)
  136. New better approximation found: 94408/30051 = 3.1415926258693556, approximating 3.141592653589793 (error=2.7720437500988737e-08)
  137. New better approximation found: 94763/30164 = 3.14159262697255, approximating 3.141592653589793 (error=2.6617243076287878e-08)
  138. New better approximation found: 95118/30277 = 3.14159262806751, approximating 3.141592653589793 (error=2.5522282953716058e-08)
  139. New better approximation found: 95473/30390 = 3.141592629154327, approximating 3.141592653589793 (error=2.443546609498526e-08)
  140. New better approximation found: 95828/30503 = 3.1415926302330917, approximating 3.141592653589793 (error=2.335670146180746e-08)
  141. New better approximation found: 96183/30616 = 3.1415926313038933, approximating 3.141592653589793 (error=2.2285899792251485e-08)
  142. New better approximation found: 96538/30729 = 3.1415926323668195, approximating 3.141592653589793 (error=2.122297360074299e-08)
  143. New better approximation found: 96893/30842 = 3.1415926334219573, approximating 3.141592653589793 (error=2.0167835845796844e-08)
  144. New better approximation found: 97248/30955 = 3.141592634469391, approximating 3.141592653589793 (error=1.9120402150463178e-08)
  145. New better approximation found: 97603/31068 = 3.1415926355092054, approximating 3.141592653589793 (error=1.808058769370291e-08)
  146. New better approximation found: 97958/31181 = 3.1415926365414837, approximating 3.141592653589793 (error=1.7048309430833797e-08)
  147. New better approximation found: 98313/31294 = 3.1415926375663066, approximating 3.141592653589793 (error=1.6023486537619647e-08)
  148. New better approximation found: 98668/31407 = 3.1415926385837554, approximating 3.141592653589793 (error=1.5006037745735057e-08)
  149. New better approximation found: 99023/31520 = 3.1415926395939087, approximating 3.141592653589793 (error=1.3995884451389884e-08)
  150. New better approximation found: 99378/31633 = 3.141592640596845, approximating 3.141592653589793 (error=1.2992948050793984e-08)
  151. New better approximation found: 99733/31746 = 3.1415926415926414, approximating 3.141592653589793 (error=1.1997151716514054e-08)
  152. New better approximation found: 100088/31859 = 3.141592642581374, approximating 3.141592653589793 (error=1.1008419065205999e-08)
  153. New better approximation found: 100443/31972 = 3.1415926435631176, approximating 3.141592653589793 (error=1.0026675489882564e-08)
  154. New better approximation found: 100798/32085 = 3.1415926445379463, approximating 3.141592653589793 (error=9.051846827645704e-09)
  155. New better approximation found: 101153/32198 = 3.141592645505932, approximating 3.141592653589793 (error=8.083861136043424e-09)
  156. New better approximation found: 101508/32311 = 3.1415926464671475, approximating 3.141592653589793 (error=7.1226455844453085e-09)
  157. New better approximation found: 101863/32424 = 3.141592647421663, approximating 3.141592653589793 (error=6.168130006756201e-09)
  158. New better approximation found: 102218/32537 = 3.1415926483695484, approximating 3.141592653589793 (error=5.220244680970154e-09)
  159. New better approximation found: 102573/32650 = 3.141592649310873, approximating 3.141592653589793 (error=4.2789203291704325e-09)
  160. New better approximation found: 102928/32763 = 3.141592650245704, approximating 3.141592653589793 (error=3.3440890057079287e-09)
  161. New better approximation found: 103283/32876 = 3.1415926511741086, approximating 3.141592653589793 (error=2.415684541290375e-09)
  162. New better approximation found: 103638/32989 = 3.1415926520961532, approximating 3.141592653589793 (error=1.493639878447084e-09)
  163. New better approximation found: 103993/33102 = 3.1415926530119025, approximating 3.141592653589793 (error=5.778906242426274e-10)
  164. New better approximation found: 104348/33215 = 3.141592653921421, approximating 3.141592653589793 (error=3.3162805834763276e-10)
  165. New better approximation found: 208341/66317 = 3.1415926534674368, approximating 3.141592653589793 (error=1.2235634727630895e-10)
  166. New better approximation found: 312689/99532 = 3.1415926536189365, approximating 3.141592653589793 (error=2.914335439641036e-11)
  167. New better approximation found: 833719/265381 = 3.141592653581078, approximating 3.141592653589793 (error=8.715250743307479e-12)
  168. New better approximation found: 1146408/364913 = 3.141592653591404, approximating 3.141592653589793 (error=1.6107115641261771e-12)
  169. New better approximation found: 3126535/995207 = 3.1415926535886505, approximating 3.141592653589793 (error=1.1426415369442111e-12)
  170. New better approximation found: 4272943/1360120 = 3.141592653589389, approximating 3.141592653589793 (error=4.04121180963557e-13)
  171. New better approximation found: 5419351/1725033 = 3.1415926535898153, approximating 3.141592653589793 (error=2.220446049250313e-14)
  172. New better approximation found: 42208400/13435351 = 3.1415926535897722, approximating 3.141592653589793 (error=2.0872192862952943e-14)
  173. New better approximation found: 47627751/15160384 = 3.141592653589777, approximating 3.141592653589793 (error=1.5987211554602254e-14)
  174. New better approximation found: 53047102/16885417 = 3.141592653589781, approximating 3.141592653589793 (error=1.199040866595169e-14)
  175. New better approximation found: 58466453/18610450 = 3.1415926535897842, approximating 3.141592653589793 (error=8.881784197001252e-15)
  176. New better approximation found: 63885804/20335483 = 3.141592653589787, approximating 3.141592653589793 (error=6.217248937900877e-15)
  177. New better approximation found: 69305155/22060516 = 3.141592653589789, approximating 3.141592653589793 (error=3.9968028886505635e-15)
  178. New better approximation found: 74724506/23785549 = 3.141592653589791, approximating 3.141592653589793 (error=2.220446049250313e-15)
  179. New better approximation found: 80143857/25510582 = 3.1415926535897927, approximating 3.141592653589793 (error=4.440892098500626e-16)
  180. New better approximation found: 245850922/78256779 = 3.141592653589793, approximating 3.141592653589793 (error=0.0)
  181. Found exact approximation: 245850922/78256779 = 3.141592653589793
  182.  
  183. (Last Approximation has 0 error because of floating point imprecision)
  184.  
  185. The basic algorithm to brute-force this is this:
  186. have two integers, A and B, initalize them to A=0 and B=1
  187. If A / B is LESS THAN target, then increment A by one. This increases A / B and gets us closer to our target.
  188. If A / B is GREATER THAN target, then increment B by one. This decreases A / B and gets us closer to our target.
  189. If A / B EQUALS our target, then we're done.
Advertisement
Add Comment
Please, Sign In to add comment