Skip to content

Instantly share code, notes, and snippets.

public int factorial(n) {
if (n == 1)
return 1;
else
`return n * factorial(n - 1);
}
# Author: Sarp Orgul
# Description: Cute little program that will approximate the value of Pi by
# generating random numbers. This algorithm takes advantage of the fact that the
# probability of two random number being coprime is equal to 6/pi^2. Note:
# For better results try using a better random number generator.
from math import gcd
from math import sqrt
from math import pow
from random import randint
int q = 22222; // lots of digit number
while (q > 9) {
digit = q % 10; // do something useful here with the digit
q = q/10; // so in the first pass 22222 -> 2222 (remember division truncates does not round)
}

Keybase proof

I hereby claim:

  • I am sarpeedo on github.
  • I am pedon (https://keybase.io/pedon) on keybase.
  • I have a public key whose fingerprint is 3541 7988 96EE B41F F975 389D 1044 8442 4102 ED4F

To claim this, I am signing this object: