Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape20a_acorn_eu_1991_march.wav » ProdPri

ProdPri

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape20a_acorn_eu_1991_march.wav
Filename: ProdPri
Read OK:
File size: 0205 bytes
Load address: FFFF1A00
Exec address: FFFF8023
Duplicates

There are 3 duplicate copies of this file in the archive:

File contents
    0 REM Product of Primes
   10 REM by Jon Millington
   20 REM (c) The Micro User
   30 MODE 3:VDU 23,1,0;0;0;0;
   40 REPEAT:REPEAT
   50 PRINT TAB(13,20)SPC 20
   60 INPUT TAB(0,20)"Your number? "N
   70 UNTIL N>1 AND N<2.1E9
   80 C%=N:K%=2:A=0:P=0
   90 REPEAT
  100 IF K%=2 THEN F%=1 ELSE F%=K%-2
  110 REPEAT
  120 IF K%=2 THEN F%=F%+1 ELSE F%=F%+2
  130 IF K%=F% THEN P=P+1 ELSE P=1
  140 IF F%>SQR N AND A=0 THEN P=0
  150 IF P=1 PRINT TAB(A,23);F%"  x"
  160 K%=F%
  170 UNTIL C% MOD F%=0 OR P=0
  180 IF P>1 PRINT TAB(A-4,22);P
  190 IF P=1 THEN A=A+LEN STR$ F%+4
  200 C%=C%/F%
  210 UNTIL C%=1 OR P=0
  220 IF P=0 PRINT TAB(0,23)"is prime";
  230 PRINT TAB(A-2,23)" "''''''
  240 UNTIL FALSE
 � Product of Primes

 � by Jon Millington
 � (c) The Micro User
 � 3:� 23,1,0;0;0;0;
( �:�
2 � �13,20)� 20
< � �0,20)"Your number? "N
F � N>1 � N<2.1E9
P C%=N:K%=2:A=0:P=0
Z �
d � K%=2 � F%=1 � F%=K%-2
n �
x � K%=2 � F%=F%+1 � F%=F%+2
� � K%=F% � P=P+1 � P=1
� � F%>� N � A=0 � P=0
� � P=1 � �A,23);F%"  x"
�
 K%=F%
� � C% � F%=0 � P=0
� � P>1 � �A-4,22);P
� � P=1 � A=A+� � F%+4
�
 C%=C%/F%
� � C%=1 � P=0
� � P=0 � �0,23)"is prime";
� � �A-2,23)" "''''''
� � �
�
00000000  0d 00 00 18 20 f4 20 50  72 6f 64 75 63 74 20 6f  |.... . Product o|
00000010  66 20 50 72 69 6d 65 73  0d 00 0a 18 20 f4 20 62  |f Primes.... . b|
00000020  79 20 4a 6f 6e 20 4d 69  6c 6c 69 6e 67 74 6f 6e  |y Jon Millington|
00000030  0d 00 14 19 20 f4 20 28  63 29 20 54 68 65 20 4d  |.... . (c) The M|
00000040  69 63 72 6f 20 55 73 65  72 0d 00 1e 18 20 eb 20  |icro User.... . |
00000050  33 3a ef 20 32 33 2c 31  2c 30 3b 30 3b 30 3b 30  |3:. 23,1,0;0;0;0|
00000060  3b 0d 00 28 08 20 f5 3a  f5 0d 00 32 12 20 f1 20  |;..(. .:...2. . |
00000070  8a 31 33 2c 32 30 29 89  20 32 30 0d 00 3c 1d 20  |.13,20). 20..<. |
00000080  e8 20 8a 30 2c 32 30 29  22 59 6f 75 72 20 6e 75  |. .0,20)"Your nu|
00000090  6d 62 65 72 3f 20 22 4e  0d 00 46 14 20 fd 20 4e  |mber? "N..F. . N|
000000a0  3e 31 20 80 20 4e 3c 32  2e 31 45 39 0d 00 50 16  |>1 . N<2.1E9..P.|
000000b0  20 43 25 3d 4e 3a 4b 25  3d 32 3a 41 3d 30 3a 50  | C%=N:K%=2:A=0:P|
000000c0  3d 30 0d 00 5a 06 20 f5  0d 00 64 1c 20 e7 20 4b  |=0..Z. ...d. . K|
000000d0  25 3d 32 20 8c 20 46 25  3d 31 20 8b 20 46 25 3d  |%=2 . F%=1 . F%=|
000000e0  4b 25 2d 32 0d 00 6e 06  20 f5 0d 00 78 1f 20 e7  |K%-2..n. ...x. .|
000000f0  20 4b 25 3d 32 20 8c 20  46 25 3d 46 25 2b 31 20  | K%=2 . F%=F%+1 |
00000100  8b 20 46 25 3d 46 25 2b  32 0d 00 82 1a 20 e7 20  |. F%=F%+2.... . |
00000110  4b 25 3d 46 25 20 8c 20  50 3d 50 2b 31 20 8b 20  |K%=F% . P=P+1 . |
00000120  50 3d 31 0d 00 8c 19 20  e7 20 46 25 3e b6 20 4e  |P=1.... . F%>. N|
00000130  20 80 20 41 3d 30 20 8c  20 50 3d 30 0d 00 96 1b  | . A=0 . P=0....|
00000140  20 e7 20 50 3d 31 20 f1  20 8a 41 2c 32 33 29 3b  | . P=1 . .A,23);|
00000150  46 25 22 20 20 78 22 0d  00 a0 0a 20 4b 25 3d 46  |F%"  x".... K%=F|
00000160  25 0d 00 aa 16 20 fd 20  43 25 20 83 20 46 25 3d  |%.... . C% . F%=|
00000170  30 20 84 20 50 3d 30 0d  00 b4 17 20 e7 20 50 3e  |0 . P=0.... . P>|
00000180  31 20 f1 20 8a 41 2d 34  2c 32 32 29 3b 50 0d 00  |1 . .A-4,22);P..|
00000190  be 19 20 e7 20 50 3d 31  20 8c 20 41 3d 41 2b a9  |.. . P=1 . A=A+.|
000001a0  20 c3 20 46 25 2b 34 0d  00 c8 0d 20 43 25 3d 43  | . F%+4.... C%=C|
000001b0  25 2f 46 25 0d 00 d2 11  20 fd 20 43 25 3d 31 20  |%/F%.... . C%=1 |
000001c0  84 20 50 3d 30 0d 00 dc  1e 20 e7 20 50 3d 30 20  |. P=0.... . P=0 |
000001d0  f1 20 8a 30 2c 32 33 29  22 69 73 20 70 72 69 6d  |. .0,23)"is prim|
000001e0  65 22 3b 0d 00 e6 18 20  f1 20 8a 41 2d 32 2c 32  |e";.... . .A-2,2|
000001f0  33 29 22 20 22 27 27 27  27 27 27 0d 00 f0 08 20  |3)" "''''''.... |
00000200  fd 20 a3 0d ff                                    |. ...|
00000205
ProdPri.m0
ProdPri.m1
ProdPri.m2
ProdPri.m4
ProdPri.m5