Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="rpi"></div><hr>
- <div id="pi"></div>
- <script>
- //PI search
- function a (n){
- return (n/(n-1))*(n/(n+1))
- }
- c=2
- d=2
- function b(){
- d = d*a(c)
- c = c+2
- document.getElementById("pi").innerHTML = d +"<br>("+c/2+ " calculation)<br><strong>Calculating PI can take a while, you will need around 1,000,000 calculation.</strong>"
- }
- setInterval(b,1)
- document.getElementById("rpi").innerHTML = "Expected Output:<br>"+Math.PI
- // Calculation Inspired By 3Blue1Brown
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement