Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
36
Task/Semiprime/PROMAL/semiprime.promal
Normal file
36
Task/Semiprime/PROMAL/semiprime.promal
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
;;; find some semiprimes - numbers with two prime factors
|
||||
|
||||
PROGRAM semiPrimes
|
||||
INCLUDE library
|
||||
|
||||
FUNC BYTE isSemiPrime
|
||||
ARG WORD n
|
||||
WORD f
|
||||
WORD factorCount
|
||||
BYTE result
|
||||
BEGIN
|
||||
f = 2
|
||||
factorCount = 0
|
||||
WHILE factorCount < 3 AND n > 1
|
||||
WHILE n % f = 0
|
||||
factorCount = factorCount + 1
|
||||
n = n / f
|
||||
f = f + 1
|
||||
IF factorCOunt = 2
|
||||
result = 1
|
||||
ELSE
|
||||
result = 0
|
||||
RETURN result
|
||||
END
|
||||
|
||||
WORD n
|
||||
BEGIN
|
||||
OUTPUT "Semiprimes under 100:#C "
|
||||
FOR n = 1 TO 99
|
||||
IF isSemiPrime( n )
|
||||
OUTPUT " #W", n
|
||||
OUTPUT "#CSemiprimes between 1670 and 1690:#C "
|
||||
FOR n = 1670 TO 1690
|
||||
IF isSemiPrime( n )
|
||||
OUTPUT " #W", n
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue