title: Can't change miller rabin formula to calculate error?
body: <p>How would I determine the numbers that aren't prime, and that my equation says it is prime?</p>
  
  <p>Lets say 100-1000 numbers that are prime, and by definition from wikipedia, "which detect all composites (once again, this means: for every composite number n, at least 3/4 (Miller–Rabin) or 1/2 (Solovay–Strassen) of numbers a are witnesses of compositeness of n). "</p>
  
  <p>How would I change the formula for error estimate?</p>
  
  <pre><code>from random import randrange
  
  def miller-rabin(i, k):
      """
      Miller Rabin written in Python
      :param i: i is the number to check for primality
      :param k: is the security value
      :return: True is the number is prime, false if not
      """
      #base case 1
      if i &lt; 2 or i % 2 == 0:
          return False
  
      #case 2
      if i == 2:
          return True
  
      r = 0
      s = i - 1
      #create initial equation n-1 = 2^(u*r)
      while s % 2 == 0:
          r += 1
          s //= 2
      for _ in range(k):
          a = randrange(2, i-1)
          x = pow(a, s, i)
          if x == 1 or x == i - 1:
              continue
          for _ in range( r - 1):
              x = pow(x, 2, i)
              if x == i - 1:
                  break
          else:
              return False
      return True
  
  print(millerR(10, 5))
  </code></pre>