title: Can anyone tell me what's wrong with my prime finding algorithm?
body: <p>Here is my prime finding algorithm, it works a bit like a sieve of Eratosthenes, but starts off with only numbers of the form 6n+/-1 (all primes excluding 2 and 3 are some form of that). My algorithm is able to take out most composite numbers, but when run to find all the primes below 100, 95 is still left in. This is the only composite number that shows up.</p>
  
  <pre><code>def primefinder(limit):
  primes = [2, 3]
  for i in range(1, (limit / 6 + 1)):
      primes.append(6 * i - 1)
      primes.append(6 * i + 1)
  
  for i in primes:
      if i &gt; 24:
          for x in primes:
              if x &lt;= i ** 0.5:
                  if i % x == 0:
                      primes.remove(i)
                      continue
              else:
                  break
  return primes
  </code></pre>
  
  <p>When run with a limit of 100, it returns the following list:</p>
  
  <p>[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 95, 97]</p>
  
  <p>while it should be returning</p>
  
  <p>[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]</p>
  
  <p>why is it not removing 95?</p>