Try this sample .sic program to display primes and factors:
Store as Prime.sic not .bas
Store as Prime.sic not .bas
Code: (Select All)
10 if stdinenabled then
20 r=10
30 goto 110
40 endif
50 print "Enter upper prime";
60 input r
70 r=int(r)
80 if r<2 then
90 end
100 endif
110 z=2
120 print " 2 = (prime)" ' first prime is 2
130 do until z>=r ' display factored numbers
140 x$=inkey$
150 if x$=chr$(27) Then
160 end
170 endif
180 z=z+1
190 x=z
200 print x;"=";
210 l=1
220 q=0
230 do until x=1
240 l=l+1
250 do while mod(x,l)=0 ' continue to divide number
260 q=q+1
270 if q>1 then
280 print " *";
290 endif
300 print l;
310 x=x/l
320 loop
330 if l>int(z/2) then ' test for maximum divisor
340 exit do
350 endif
360 if l>int(sqr(x)) then ' test maximum divisor is prime
370 if q=0 then
380 exit do
390 endif
400 endif
410 loop
420 if q=0 then ' display number is prime
430 print " (prime)";
440 endif
450 print
460 loop
470 stop