Primes by Trial Division - BCPL

30 April 2017

GET "libhdr"

MANIFEST $( N=100 
            //N=1000
            //N=10000
         $)

LET start() BE 
$( LET i, found, count = ?, 0, 2
   LET primes = VEC (N-1)

   $( writef("%n*n", count)
      primes!found := count
      found := found + 1
      count := count + 1
      IF found = N BREAK
      
      i := 0
      $( TEST (count REM primes!i) = 0 
         THEN $( i := 0
                 count := count + 1
              $)
         ELSE i := i + 1
      $) REPEATUNTIL (i = found)
   $) REPEAT
$)

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 Implementations

BCPL

perl

REXX

ruby

Tcl