|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1280 (0x500)
Types: TextFile
Names: »PRIMES.PAS«
└─⟦1a1ae220f⟧ Bits:30004190 COMPAS Pascal v.2.2
└─⟦this⟧ »PRIMES.PAS«
└─⟦693a7a378⟧ Bits:30003305 COMPAS, RcTekst, RcKalk, RCComal80 til RC703
└─⟦this⟧ »PRIMES.PAS«
└─⟦6bdda2365⟧ Bits:30005253 COMPAS Pascal v2.21 til CR7
└─⟦this⟧ »PRIMES.PAS«
└─⟦7b7460039⟧ Bits:30005889 KnowledgeMan - ACP - dBase II
└─⟦this⟧ »PRIMES.PAS«
└─⟦7e35b155b⟧ Bits:30005838 CP/M 58K v. 2.2 med COMPAS Pascal 2.13DK (RC700)
└─⟦this⟧ »PRIMES.PAS«
└─⟦856c4d8a3⟧ Bits:30003073 SW1729 COMPAS Pascal v2.20 installationsdiskette til Piccolo
└─⟦this⟧ »PRIMES.PAS«
└─⟦d814f614c⟧ Bits:30008872 EDB Trænings- og Erhvervs Center / Almen Nyttig Data Service
└─⟦this⟧ »PRIMES.PAS«
└─⟦f5abb7d57⟧ Bits:30005754 SW1329/D8 COMPAS Pascal v2.20 (RC703)
└─⟦this⟧ »PRIMES.PAS«
PROGRAM PRIMES; æ$R-å
æ This program will calculate and display all prime numbers å
æ between 1 and 30000. The algorithm of the program is to å
æ start out with an array containing representatives for å
æ all odd numbers between 3 and 29999. Starting from 3 and å
æ working upwards, each odd number is then tested. If a å
æ number is still a member of the list when it is tested, å
æ it is a prime number, and thus it is printed, and all odd å
æ multiples of the number are eliminated from the list. As å
æ can be expected, the program is quite slow on calculating å
æ the very first primes, but from then on it gets faster å
æ and faster. Note that 1 and 2 are assumed to be primes, å
æ and not actually calculated. å
CONST
MAX2 = 15000; æ MAXPRIME/2 å
MAX3 = 10000; æ MAXPRIME/3 å
VAR
I,J,K: INTEGER;
TEST: ARRAYÆ2..MAX2Å OF BOOLEAN;
BEGIN
WRITE(1:8,2:8);
FOR I:=2 TO MAX2 DO TESTÆIÅ:=TRUE;
FOR I:=2 TO MAX2 DO
IF TESTÆIÅ THEN
BEGIN
J:=I+I-1; WRITE(J:8);
IF J<MAX3 THEN
BEGIN
K:=I+J;
WHILE K<=MAX2 DO
BEGIN
TESTÆKÅ:=FALSE; K:=K+J;
END;
END;
END;
WRITELN;
END.
«eof»