15,112,866 members
Home / Discussions / C#

# C#

 Re: Sieve of Eratosthenes J4amieC12-Sep-12 5:53 J4amieC 12-Sep-12 5:53
 Re: Sieve of Eratosthenes Pete O'Hanlon12-Sep-12 5:54 Pete O'Hanlon 12-Sep-12 5:54
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 5:59 WebMaster 12-Sep-12 5:59
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 6:02 J4amieC 12-Sep-12 6:02
 Re: Sieve of Eratosthenes Manfred Rudolf Bihy12-Sep-12 6:06 Manfred Rudolf Bihy 12-Sep-12 6:06
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 6:07 J4amieC 12-Sep-12 6:07
 Re: Sieve of Eratosthenes Pete O'Hanlon12-Sep-12 6:04 Pete O'Hanlon 12-Sep-12 6:04
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 6:16 WebMaster 12-Sep-12 6:16
 What have you to say? I guess you can't collate the code and algorithm, so I help you by this: C#Copy Code ```//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 6:22 Pete O'Hanlon 12-Sep-12 6:22
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 6:23 J4amieC 12-Sep-12 6:23
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 6:48 WebMaster 12-Sep-12 6:48
 Re: Sieve of Eratosthenes J4amieC12-Sep-12 6:59 J4amieC 12-Sep-12 6:59
 Re: Sieve of Eratosthenes WebMaster12-Sep-12 7:11 WebMaster 12-Sep-12 7:11
 Re: Sieve of Eratosthenes Rage12-Sep-12 7:23 Rage 12-Sep-12 7:23
 Re: Sieve of Eratosthenes Pete O'Hanlon12-Sep-12 7:25 Pete O'Hanlon 12-Sep-12 7:25
 Proper implementation of Sieve of Eratosthenes Clifford Nelson12-Sep-12 11:45 Clifford Nelson 12-Sep-12 11:45
 Re: Proper implementation of Sieve of Eratosthenes WebMaster12-Sep-12 12:00 WebMaster 12-Sep-12 12:00
 Re: Proper implementation of Sieve of Eratosthenes Clifford Nelson12-Sep-12 12:20 Clifford Nelson 12-Sep-12 12:20
 Re: Proper implementation of Sieve of Eratosthenes Dave Kreskowiak12-Sep-12 13:44 Dave Kreskowiak 12-Sep-12 13:44
 Re: Proper implementation of Sieve of Eratosthenes Clifford Nelson12-Sep-12 14:07 Clifford Nelson 12-Sep-12 14:07
 Re: Proper implementation of Sieve of Eratosthenes Dave Kreskowiak12-Sep-12 19:25 Dave Kreskowiak 12-Sep-12 19:25
 Re: Sieve of Eratosthenes Thomas Daniels12-Sep-12 6:29 Thomas Daniels 12-Sep-12 6:29
 Re: Sieve of Eratosthenes Kenneth Haugland13-Sep-12 4:33 Kenneth Haugland 13-Sep-12 4:33
 Re: Sieve of Eratosthenes PIEBALDconsult12-Sep-12 15:23 PIEBALDconsult 12-Sep-12 15:23
 Substitution of Paths in HyperLinkField with File Names ASPnoob12-Sep-12 5:23 ASPnoob 12-Sep-12 5:23
 Last Visit: 31-Dec-99 19:00     Last Update: 27-Nov-21 8:40 Refresh ᐊ Prev1...1764176517661767176817691770177117721773 Next ᐅ