Substring primes: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added a comment.) |
m (→{{header|REXX}}: changed the location of counting of primality tests.) |
||
Line 175: | Line 175: | ||
do k=1 for L-1 /*test for primality for all substrings*/ |
do k=1 for L-1 /*test for primality for all substrings*/ |
||
do m=k+1 to L; y= substr(x, k, m-1) /*extract a substring from the X prime.*/ |
do m=k+1 to L; y= substr(x, k, m-1) /*extract a substring from the X prime.*/ |
||
ptests= ptests + 1 /*bump count of the # primality tests. */ |
|||
if \!.y then iterate j /*does substring of X not prime? Skip.*/ |
if \!.y then iterate j /*does substring of X not prime? Skip.*/ |
||
end /*m*/ |
end /*m*/ |
||
Line 210: | Line 211: | ||
Found 9 primes (base ten) where all substrings are also primes < 500 |
Found 9 primes (base ten) where all substrings are also primes < 500 |
||
14 primality tests were performed. |
|||
</pre> |
</pre> |
||