Palindromic primes: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed a comment.) |
m (→{{header|REXX}}: added whitespace to the output for wider columns.) |
||
Line 12: | Line 12: | ||
if cols=='' | cols=="," then cols= 10 /* " " " " " " */ |
if cols=='' | cols=="," then cols= 10 /* " " " " " " */ |
||
call genP /*build array of semaphores for primes.*/ |
call genP /*build array of semaphores for primes.*/ |
||
w= max( |
w= max(8, length( commas(hi) ) ) /*max width of a number in any column. */ |
||
@pal= ' palindromic primes that are < ' commas(hi) |
@pal= ' palindromic primes that are < ' commas(hi) |
||
if cols>0 then say ' index │'center(@pal, 1 + cols*(w+1) ) |
if cols>0 then say ' index │'center(@pal, 1 + cols*(w+1) ) |
||
Line 53: | Line 53: | ||
{{out|output|text= when using the default inputs:}} |
{{out|output|text= when using the default inputs:}} |
||
<pre> |
<pre> |
||
index │ palindromic primes that are < 1,000 |
index │ palindromic primes that are < 1,000 |
||
───────┼─────────────────────────────────────────────────────────────────────────────────────────── |
|||
───────┼───────────────────────────────────────────────────────────────────────────────── |
|||
1 │ 2 3 5 7 11 101 131 151 181 191 |
1 │ 2 3 5 7 11 101 131 151 181 191 |
||
11 │ 313 353 373 383 727 757 787 797 919 929 |
11 │ 313 353 373 383 727 757 787 797 919 929 |
||
───────┴─────────────────────────────────────────────────────────────────────────────────────────── |
|||
───────┴───────────────────────────────────────────────────────────────────────────────── |
|||
Found 20 palindromic primes that are < 1,000 |
Found 20 palindromic primes that are < 1,000 |
||
Line 64: | Line 64: | ||
{{out|output|text= when using the input of: <tt> 100000 </tt>}} |
{{out|output|text= when using the input of: <tt> 100000 </tt>}} |
||
<pre> |
<pre> |
||
index │ palindromic primes that are < |
index │ palindromic primes that are < 10,000 |
||
───────┼─────────────────────────────────────────────────────────────────────────────────────────── |
|||
───────┼───────────────────────────────────────────────────────────────────────────────── |
|||
1 │ 2 3 5 7 11 101 131 151 181 191 |
1 │ 2 3 5 7 11 101 131 151 181 191 |
||
11 │ 313 353 373 383 727 757 787 797 919 929 |
11 │ 313 353 373 383 727 757 787 797 919 929 |
||
21 │ 10,301 10,501 10,601 11,311 11,411 12,421 12,721 12,821 13,331 13,831 |
21 │ 10,301 10,501 10,601 11,311 11,411 12,421 12,721 12,821 13,331 13,831 |
||
31 │ 13,931 14,341 14,741 15,451 15,551 16,061 16,361 16,561 16,661 17,471 |
31 │ 13,931 14,341 14,741 15,451 15,551 16,061 16,361 16,561 16,661 17,471 |
||
41 │ 17,971 18,181 18,481 19,391 19,891 19,991 30,103 30,203 30,403 30,703 |
41 │ 17,971 18,181 18,481 19,391 19,891 19,991 30,103 30,203 30,403 30,703 |
||
51 │ 30,803 31,013 31,513 32,323 32,423 33,533 34,543 34,843 35,053 35,153 |
51 │ 30,803 31,013 31,513 32,323 32,423 33,533 34,543 34,843 35,053 35,153 |
||
61 │ 35,353 35,753 36,263 36,563 37,273 37,573 38,083 38,183 38,783 39,293 |
61 │ 35,353 35,753 36,263 36,563 37,273 37,573 38,083 38,183 38,783 39,293 |
||
71 │ 70,207 70,507 70,607 71,317 71,917 72,227 72,727 73,037 73,237 73,637 |
71 │ 70,207 70,507 70,607 71,317 71,917 72,227 72,727 73,037 73,237 73,637 |
||
81 │ 74,047 74,747 75,557 76,367 76,667 77,377 77,477 77,977 78,487 78,787 |
81 │ 74,047 74,747 75,557 76,367 76,667 77,377 77,477 77,977 78,487 78,787 |
||
91 │ 78,887 79,397 79,697 79,997 90,709 91,019 93,139 93,239 93,739 94,049 |
91 │ 78,887 79,397 79,697 79,997 90,709 91,019 93,139 93,239 93,739 94,049 |
||
101 │ 94,349 94,649 94,849 94,949 95,959 96,269 96,469 96,769 97,379 97,579 |
101 │ 94,349 94,649 94,849 94,949 95,959 96,269 96,469 96,769 97,379 97,579 |
||
111 │ 97,879 98,389 98,689 |
111 │ 97,879 98,389 98,689 |
||
───────┴─────────────────────────────────────────────────────────────────────────────────────────── |
|||
───────┴───────────────────────────────────────────────────────────────────────────────── |
|||
Found 113 palindromic primes that are < |
Found 113 palindromic primes that are < 10,000 |
||
</pre> |
</pre> |
||