Primes whose first and last number is 3: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added highlighting to the REXX section header.) |
m (→{{header|REXX}}: changed "ending" to "trailing" (decimal digit).) |
||
Line 105: | Line 105: | ||
call genP /*build array of semaphores for primes.*/ |
call genP /*build array of semaphores for primes.*/ |
||
w= 10 /*width of a number in any column. */ |
w= 10 /*width of a number in any column. */ |
||
title= ' primes N (in base ten) that have a leading and |
title= ' primes N (in base ten) that have a leading and trailing digit of ' dig , |
||
" where N < " commas(hi) |
" where N < " commas(hi) |
||
if cols>0 then say ' index │'center(title, 1 + cols*(w+1) ) |
if cols>0 then say ' index │'center(title, 1 + cols*(w+1) ) |
||
Line 116: | Line 116: | ||
if Td\==dig then iterate /* " " " " trailing ? ? */ /* ◄■■■■■■■ a filter.*/ |
if Td\==dig then iterate /* " " " " trailing ? ? */ /* ◄■■■■■■■ a filter.*/ |
||
found= found + 1 /*bump the number of primes found. */ |
found= found + 1 /*bump the number of primes found. */ |
||
if cols<= |
if cols<=0 then iterate /*Build the list (to be shown later)? */ |
||
c= commas(@.j) /*maybe add commas to the number. */ |
c= commas(@.j) /*maybe add commas to the number. */ |
||
$= $ right(c, max(w, length(c) ) ) /*add a prime ──► $ list, allow big #*/ |
$= $ right(c, max(w, length(c) ) ) /*add a prime ──► $ list, allow big #*/ |
||
Line 146: | Line 146: | ||
{{out|output|text= when using the default inputs:}} |
{{out|output|text= when using the default inputs:}} |
||
<pre> |
<pre> |
||
index │ |
index │ primes N (in base ten) that have a leading and trailing digit of 3 where N < 4,000 |
||
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
||
1 │ 3 313 353 373 383 3,023 3,083 3,163 3,203 3,253 |
1 │ 3 313 353 373 383 3,023 3,083 3,163 3,203 3,253 |
||
Line 154: | Line 154: | ||
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
||
Found 33 primes N (in base ten) that have a leading and |
Found 33 primes N (in base ten) that have a leading and trailing digit of 3 where N < 4,000 |
||
</pre> |
</pre> |
||
{{out|output|text= when using the default inputs of: <tt> 1000000 -1 </tt>}} |
{{out|output|text= when using the default inputs of: <tt> 1000000 -1 </tt>}} |
||
<pre> |
<pre> |
||
Found 2,251 primes N (in base ten) that have a leading and |
Found 2,251 primes N (in base ten) that have a leading and trailing digit of 3 where N < 1,000,000 |
||
</pre> |
</pre> |
||