TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Proportional Font
Show HTML Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Date: Fri, 17 Nov 2000 22:25:50 -0800
Reply-To: Tom Moran <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: Decision Aids
From: Tom Moran <[log in to unmask]>
Parts/Attachments: text/plain (13 lines)
As I recall, RR's Ada compilers used to come with that as an example Ada
program.  That was a long time ago, but it's conceivable it's on  Byte magazine used to use it as a benchmark, but
that was a really long time ago.
  I just looked on BIX and found three versions from 1988, for the Mac,
the TI Color Computer, and, in Small-C, for the 8088-80386.
  The idea is straightforward: Create a boolean array with True for each
potential prime from 2 .. N.  Then take each known prime in turn (2 is a
known prime) and mark all its multiples as False (not prime).  The ones
left True when you are done are not divisibly by any number less than
themselves (except 1 of course) so they must be primes.  It's pretty
straightforward to code.