Odd squarefree semiprimes: Difference between revisions
Content added Content deleted
(→{{header|ALGOL 68}}: Calculate a more sensible number of primes) |
|||
Line 28: | Line 28: | ||
# show odd square free semi-primes up to 1000 # |
# show odd square free semi-primes up to 1000 # |
||
INT max number = 1000; |
INT max number = 1000; |
||
INT max prime = 1 + ( max number OVER 3 ); # the smallest odd prime is 3, so this shuld be enough primes # |
|||
[]INT prime = prime list( max prime ); |
|||
[ 1 : max number ]BOOL numbers; FOR i TO max number DO numbers[ i ] := FALSE OD; |
[ 1 : max number ]BOOL numbers; FOR i TO max number DO numbers[ i ] := FALSE OD; |
||
FOR i FROM 2 TO |
FOR i FROM 2 TO UPB prime - 1 DO |
||
FOR j FROM i + 1 TO |
FOR j FROM i + 1 TO UPB prime |
||
WHILE INT pq = prime[ i ] * prime[ j ]; |
WHILE INT pq = prime[ i ] * prime[ j ]; |
||
pq < max number |
pq < max number |