tofran / pi-from-random-numbers

Unusual way to achieve π: Generating Pi from random numbers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unusual way to achieve π: Generating Pi from random numbers

The purpose of this repo is to gather (programming) solutions for the peculiar procedure for generating / achieving π (Pi) that Matt Parker presented in this video.

Why

  1. In commemoration for Pi Day 2017.
  2. Having fun.
  3. No apparent logic reason.

How does it work

Since the Probability of Two (random) Integers Being Coprime is given by:

formula 1 Proof and demonstration

We can generate lots of numbers and calculate π by:

formula 2

Watch Matt Parker generating π from 1,000 random numbers by rolling a dice on here.

Acknowledgments

All solutions are from these users (in no particular order), some are quite efficient others not so much. Regardless thanks very much.

  • Matt Parker
  • Torfi Þorgrímsson
  • TheWioreks
  • Alyan Zahid
  • Andriamanitra
  • Bendik Mihle Hansen
  • Buttercak3
  • Ecrou Ecrouisseur
  • Georgi Iliev
  • Gerard Kool
  • Pedro Sousa
  • Bengineer8
  • 梁瑋瀚
  • TheWioreks
  • LaugeRønberg
  • Justin Murtagh
  • Ando Bando
  • Chris Pedro
  • Alex Walters
  • Mark Johnson
  • Clark Cox
  • navkums
  • Bebopity
  • GLaDHuRriCAn
  • Tom Spink
  • seevernet1
  • Cody Woodard
  • JustForFunc
  • John Lindstedt
  • Erik Lindemann
  • Altoids The Destroyer
  • limzykenneth
  • MDuh Gaming
  • QuomoZ
  • elijah finn
  • Josh Grigonis
  • wHiTEY 542
  • Bryan Ng

Happy Pi Day!

About

Unusual way to achieve π: Generating Pi from random numbers


Languages

Language:Python 28.0%Language:C 17.9%Language:C# 12.0%Language:Java 10.5%Language:Lua 7.8%Language:MATLAB 7.3%Language:JavaScript 4.3%Language:APL 3.2%Language:Go 2.3%Language:Processing 2.2%Language:C++ 1.6%Language:Mathematica 1.1%Language:Haskell 0.9%Language:Visual Basic 0.7%