Primes by Trial Division - LCSI LogoWriter

15 February 2025

LCSI LogoWriter is similar to Logotron LOGO, with slightly different conditionals, more sophisticated scoping, and a friendlier editor. Case is insignificant; keywords are capitalized here for clarity.

TO while :cond :proc
IF NOT RUN :cond [ STOP ]
RUN :proc
while :cond :proc
END

TO isprime :n :primes
MAKE "i 1
REPEAT COUNT :primes [
  IFELSE (REMAINDER :n item :i :primes) = 0
    [ OP 1 ]
    [ MAKE "i (1 + :i) ]
]
OP 0
END

TO primes :n
MAKE "primes []
MAKE "count 2
MAKE "found 0
WHILE [ :found < :n ] [
  IF (isprime :count) = 0 [
    PR :count
    MAKE "primes (LPUT :count :primes)
    MAKE "found (1 + :found)
  ]
  MAKE "count (1 + :count)
]
END

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 LOGOs

Acornsoft Logo

DR LOGO

LCSI LogoWriter

Logotron LOGO

Terrapin Logo PLUS

TI LOGO

UCB LOGO