Primes by Trial Division - Oberon

1 October 2017

MODULE Benchmark;

IMPORT Out;

CONST NumPrimes = 100;
(* CONST NumPrimes = 1000; *)

	PROCEDURE nPrimes* (VAR NumPrimes : LONGINT);
	VAR Count, Index, Found : LONGINT;
		Primes : ARRAY NumPrimes OF LONGINT;
	BEGIN
		
		Found := 0;
		Count := 2;
		
		WHILE Found < NumPrimes DO
		
			Primes[Found] := Count;
			Out.Int(Count, 6);
			Out.Ln;
			INC(Count);
			INC(Found);
			
			Index := 0;
			REPEAT
				IF Count MOD Primes[Index] = 0 THEN
					INC(Count);
					Index := 0
				END;
				INC(Index);
			UNTIL Index = Found
		END;
	
	END nPrimes;

END Benchmark.

Benchmark.nPrimes

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026

Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Primes Benchmark Source

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Primes Benchmark Results

Other Pascal Family

Ada-83

Ada-95

Modula-2

TopSpeed Modula-2

Oberon

Oberon-2

Active Oberon

Pascal

VS Pascal