15,940,550 members
Home / Discussions / C#

# C#

 Re: Sieve of Eratosthenes J4amieC12-Sep-12 4:53 J4amieC 12-Sep-12 4:53
 Re: Sieve of Eratosthenes Pete O'Hanlon12-Sep-12 4:54 Pete O'Hanlon 12-Sep-12 4:54
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 4:59 WebMaster 12-Sep-12 4:59
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 5:02 J4amieC 12-Sep-12 5:02
 Re: Sieve of Eratosthenes Manfred Rudolf Bihy12-Sep-12 5:06 Manfred Rudolf Bihy 12-Sep-12 5:06
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 5:07 J4amieC 12-Sep-12 5:07
 Re: Sieve of Eratosthenes Pete O'Hanlon12-Sep-12 5:04 Pete O'Hanlon 12-Sep-12 5:04
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 5:16 WebMaster 12-Sep-12 5:16
 What have you to say? I guess you can't collate the code and algorithm, so I help you by this: C# ```//1. Create a list of consecutive integers from 2 to n: (2, 3, 4, ..., n). List numbers = new List(); for (int i = 2; i < 2000000; i++) numbers.Add(i); //2. Initially, let p equal 2, the first prime number. for (int p = 0; p < numbers.Count - 1; p++) if (numbers[p].IsPrime) for (int j = p + 1; j < numbers.Count - 1; j++) //note that some of them may have already been marked. if (numbers[p].IsPrime) //3. Starting from p, count up in increments of p and mark each of these numbers greater than p itself in the list. These numbers will be 2p, 3p, 4p, etc if (numbers[j].Value % numbers[p].Value == 0) numbers[j].IsPrime = false;``` Meysammodified 12-Sep-12 14:43pm.
 Re: Sieve of Eratosthenes Pete O'Hanlon12-Sep-12 5:22 Pete O'Hanlon 12-Sep-12 5:22
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 5:23 J4amieC 12-Sep-12 5:23
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 5:48 WebMaster 12-Sep-12 5:48
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 5:59 J4amieC 12-Sep-12 5:59
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 6:11 WebMaster 12-Sep-12 6:11
 Re: Sieve of Eratosthenes Rage12-Sep-12 6:23 Rage 12-Sep-12 6:23
 Re: Sieve of Eratosthenes Pete O'Hanlon12-Sep-12 6:25 Pete O'Hanlon 12-Sep-12 6:25
 Proper implementation of Sieve of Eratosthenes Clifford Nelson12-Sep-12 10:45 Clifford Nelson 12-Sep-12 10:45
 Re: Proper implementation of Sieve of Eratosthenes WebMaster12-Sep-12 11:00 WebMaster 12-Sep-12 11:00
 Re: Proper implementation of Sieve of Eratosthenes Clifford Nelson12-Sep-12 11:20 Clifford Nelson 12-Sep-12 11:20
 Re: Proper implementation of Sieve of Eratosthenes Dave Kreskowiak12-Sep-12 12:44 Dave Kreskowiak 12-Sep-12 12:44
 Re: Proper implementation of Sieve of Eratosthenes Clifford Nelson12-Sep-12 13:07 Clifford Nelson 12-Sep-12 13:07
 Re: Proper implementation of Sieve of Eratosthenes Dave Kreskowiak12-Sep-12 18:25 Dave Kreskowiak 12-Sep-12 18:25
 Re: Sieve of Eratosthenes Thomas Daniels12-Sep-12 5:29 Thomas Daniels 12-Sep-12 5:29
 Re: Sieve of Eratosthenes Kenneth Haugland13-Sep-12 3:33 Kenneth Haugland 13-Sep-12 3:33
 Re: Sieve of Eratosthenes PIEBALDconsult12-Sep-12 14:23 PIEBALDconsult 12-Sep-12 14:23
 Substitution of Paths in HyperLinkField with File Names ASPnoob12-Sep-12 4:23 ASPnoob 12-Sep-12 4:23
 Last Visit: 31-Dec-99 18:00     Last Update: 18-Jul-24 3:14 Refresh ᐊ Prev1...1875187618771878187918801881188218831884 Next ᐅ