Special odd numbers: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed a comment.) |
m (→{{header|REXX}}: change some comments.) |
||
Line 70: | Line 70: | ||
if cols>0 then say '───────┼'center("" , 1 + cols*(w+1), '─') |
if cols>0 then say '───────┼'center("" , 1 + cols*(w+1), '─') |
||
idx= 1 /*initialize the index of output lines.*/ |
idx= 1 /*initialize the index of output lines.*/ |
||
$=; ss.= 0 /*a list of squarefree semiprimes. |
$=; ss.= 0 /*a list of odd squarefree semiprimes. */ |
||
do j=2 while @.j < hi /* |
do j=2 while @.j < hi /*gen odd squarefree semiprimes < HI.*/ |
||
do k=j+1 while @.k < hi /*ensure primes are squarefree & < HI.*/ |
do k=j+1 while @.k < hi /*ensure primes are squarefree & < HI.*/ |
||
_= @.j * @.k /*calculate the product of 2 odd primes*/ |
_= @.j * @.k /*calculate the product of 2 odd primes*/ |
||
Line 78: | Line 78: | ||
end /*k*/ |
end /*k*/ |
||
end /*j*/ |
end /*j*/ |
||
sss= 0 /* |
sss= 0 /*number of odd squarefree semiprimes. */ |
||
do m=3 by 2 to hi-1 /*search a list of possible candicates.*/ |
do m=3 by 2 to hi-1 /*search a list of possible candicates.*/ |
||
if \ss.m then iterate /*Does this number exist? No, skip it.*/ |
if \ss.m then iterate /*Does this number exist? No, skip it.*/ |
||
sss= sss + 1 /*bump count of |
sss= sss + 1 /*bump count of odd sq─free semiprimes.*/ |
||
if cols==0 then iterate /*Build the list (to be shown later)? */ |
if cols==0 then iterate /*Build the list (to be shown later)? */ |
||
c= commas(m) /*maybe add commas to the number. */ |
c= commas(m) /*maybe add commas to the number. */ |