Substring primes: Difference between revisions
Content deleted Content added
add FreeBASIC |
m →{{header|REXX}}: (to avoid name calling) elided primality test counting |
||
Line 194:
if verify(x2, 25 , 'M')>0 then iterate /* " X2 part " " " " " */
L= length(x) /*obtain the length of the X prime.*/
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.*/
if \!.y then iterate j /*does substring of X not prime? Skip.*/
end /*m*/
Line 207 ⟶ 205:
if $\=='' then say center(1,7)"│" substr($, 2) /*display the list of substring primes.*/
say; say 'Found ' words($) @sprs
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 232 ⟶ 229:
Found 9 primes (base ten) where all substrings are also primes < 500
</pre>
|