something i just thrown together for people to play with:
GeSHi`ed javascript code for
pVr 1
2
3
4
56
7
| <script>
num=5000;
z=0;x=0;pi="1415926535897932384626433832795028841971693993751058";
for (var i=0;i<num;i++){Check=(Math.random()/Math.random())+".";Check=Check.substr(4,1);if (Check==pi.substr(z,1)){if (z>x){x=z;document.write("Currently: "+x+"<br>")}z++;}else{z=0;}}
</script> |
1000 monkeys and 1000 typewriters got me thinking, how well would a random number generator guess the decimals of Pi?
you can change variable "num" to the amount of numbers you wish to try.
also just for people learning:
WHICH=1>
loop Num times###>
1: Check=random number>
2: compare Check to WHICH digit of Pi>
3: if Check=WHICH digit of Pi then WHICH + 1 and print existing succession and start '1:' again
###