Skip to content

Instantly share code, notes, and snippets.

Created October 5, 2011 01:16
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Infinite sequence of prime numbers that uses wheel factorization.
public class WheelPrimeSequence : IEnumerable<int>
public IEnumerator<int> GetEnumerator()
yield return 2;
yield return 3;
yield return 5;
var e = new WheelPrimeEnumerator();
while (e.MoveNext())
yield return e.Current;
IEnumerator IEnumerable.GetEnumerator()
return GetEnumerator();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment