Nice primes: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: added a foot header to the output.)
Line 648: Line 648:


if $\=='' then say center(idx, 7)"│" substr($, 2) /*possible display residual output.*/
if $\=='' then say center(idx, 7)"│" substr($, 2) /*possible display residual output.*/
if cols>0 then say '───────┴'center("" , 1 + cols*(w+1), '─')
say
say
say 'Found ' commas(Nprimes) @nice ' (not inclusive).'
say 'Found ' commas(Nprimes) @nice ' (not inclusive).'
Line 663: Line 664:
if j// 3==0 then iterate /*" " " 3? */
if j// 3==0 then iterate /*" " " 3? */
if j// 7==0 then iterate /*" " " 7? */
if j// 7==0 then iterate /*" " " 7? */
/* [↑] the above five lines saves time*/
/* [↑] the above 3 lines saves time.*/
do k=5 while s.k<=j /* [↓] divide by the known odd primes.*/
do k=5 while s.k<=j /* [↓] divide by the known odd primes.*/
if j // @.k == 0 then iterate j /*Is J ÷ X? Then not prime. ___ */
if j // @.k == 0 then iterate j /*Is J ÷ X? Then not prime. ___ */
Line 677: Line 678:
21 │ 821 839 853 857 887 907 911 929 941 947
21 │ 821 839 853 857 887 907 911 929 941 947
31 │ 977 983 997
31 │ 977 983 997
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────


Found 33 nice primes that are between 500 and 1,000 (not inclusive).
Found 33 nice primes that are between 500 and 1,000 (not inclusive).