TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< 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]>
Subject:
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
www.rrsoftware.com  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.

ATOM RSS1 RSS2