# # canola - canon canola 1614p emulator # Copyright (C) 2011 Peter Miller # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 3, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # ; ; This software was provided by Chris Baird ; in the form of images of the program cards. This was processed by ; canola-card-scanner(1) to produce text of the program which was then ; edited to produce the file you see here. ; ; ---------- Card-Pocket-Begin -------------------------------------------- ; Title: Prime Numbers, by C. Baird ; Style: aus ; Disassemble: true ; ---------- Card-Pocket-End ---------------------------------------------- ; ; The ENTRY lamp will be lit once at the beginning of the program, to ; request a number to start from. After that will will proceed to print ; prime numbers indefinitely. ; ENT ; start from here SM3 FJ 1 CM5 RM3 2 M5 += SM3 ; number being tested => m3 SQRT SM4 ; upper bound FJ 2 1 M5 ; trial divisor RM4 RM5 -= ; we have reached upper bound if negative MJ 3 ; this one is prime RM3 / RM5 FLOOR 0 ; the next += will round to zero decimal places += * RM5 += RM3 -= MJ 2 ; if less than zero, it means did not divide evenly UJ 1 ; this one is composite FJ 3 RM3 PRINT ; print this one, it is prime UJ 1