[Issue 4164] sieve Sample D Program -- need documentation for array representation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 14 21:45:52 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4164



--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> 2010-05-14 21:45:48 PDT ---
Steven wrote in the n.g.:

I think the issue is that the expectation is that array index x represents the
number x.  But it doesn't seem that way.

the i + i + 3 is very odd indeed.

If we consider each index, it means the first element represents 0 + 0 + 3 = 3;
The second element represents 1 + 1 + 3 = 5;
The third element represents 2 + 2 + 3 = 7;

So it looks like the numbers represented by the array actually go from 3 to
(8190 + 8190 + 3) or 16383.

According to Wolfram Alpha, the number of primes in that list is 1899

http://www.wolframalpha.com/input/?i=primes+in+3+..+16383

A comment to explain the representation of the array may be good.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list