Sieve of Eratosthenes: Difference between revisions
Content deleted Content added
→{{header|Perl 6}}: Removed broken examples, gave one based on sets |
m Minor C# fixes |
||
Line 1,284: | Line 1,284: | ||
using System.Collections.Generic; |
using System.Collections.Generic; |
||
using System.Linq; |
using System.Linq; |
||
using PrimeT = UInt32; |
using PrimeT = System.UInt32; |
||
class PrimesBird : IEnumerable<PrimeT> { |
class PrimesBird : IEnumerable<PrimeT> { |
||
private struct CIS<T> { |
private struct CIS<T> { |
||
Line 1,331: | Line 1,331: | ||
using System.Collections.Generic; |
using System.Collections.Generic; |
||
using System.Linq; |
using System.Linq; |
||
using PrimeT = UInt32; |
using PrimeT = System.UInt32; |
||
class PrimesTreeFold : IEnumerable<PrimeT> { |
class PrimesTreeFold : IEnumerable<PrimeT> { |
||
private struct CIS<T> { |
private struct CIS<T> { |
||
Line 1,385: | Line 1,385: | ||
First, an implementation of a Min Heap Priority Queue is provided as extracted from the entry at [http://rosettacode.org/wiki/Priority_queue#C.23 RosettaCode], with only the necessary methods duplicated here: |
First, an implementation of a Min Heap Priority Queue is provided as extracted from the entry at [http://rosettacode.org/wiki/Priority_queue#C.23 RosettaCode], with only the necessary methods duplicated here: |
||
<lang csharp>namespace PriorityQ { |
<lang csharp>namespace PriorityQ { |
||
using KeyT = UInt32; |
using KeyT = System.UInt32; |
||
using System; |
using System; |
||
using System.Collections.Generic; |
using System.Collections.Generic; |
||
Line 1,448: | Line 1,448: | ||
using System.Collections.Generic; |
using System.Collections.Generic; |
||
using System.Linq; |
using System.Linq; |
||
using PrimeT = UInt32; |
using PrimeT = System.UInt32; |
||
class PrimesPQ : IEnumerable<PrimeT> { |
class PrimesPQ : IEnumerable<PrimeT> { |
||
private IEnumerator<PrimeT> nmrtr() { |
private IEnumerator<PrimeT> nmrtr() { |
||
Line 1,490: | Line 1,490: | ||
using System.Collections.Generic; |
using System.Collections.Generic; |
||
using System.Linq; |
using System.Linq; |
||
using PrimeT = UInt32; |
using PrimeT = System.UInt32; |
||
class PrimesDict : IEnumerable<PrimeT> { |
class PrimesDict : IEnumerable<PrimeT> { |
||
private IEnumerator<PrimeT> nmrtr() { |
private IEnumerator<PrimeT> nmrtr() { |
||
Line 1,530: | Line 1,530: | ||
using System.Collections.Generic; |
using System.Collections.Generic; |
||
using System.Linq; |
using System.Linq; |
||
using PrimeT = UInt32; |
using PrimeT = System.UInt32; |
||
class PrimesPgd : IEnumerable<PrimeT> { |
class PrimesPgd : IEnumerable<PrimeT> { |
||
private const int PGSZ = 1 << 14; // L1 CPU cache size in bytes |
private const int PGSZ = 1 << 14; // L1 CPU cache size in bytes |