Multi-base primes: Difference between revisions

→‎{{header|Phix}}: added 0.9 only times
(→‎{{header|Phix}}: improved range checking, at some cost to performance)
(→‎{{header|Phix}}: added 0.9 only times)
Line 325:
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">digits</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">to</span> <span style="color: #000000;">1</span> <span style="color: #008080;">by</span> <span style="color: #0000FF;">-</span><span style="color: #000000;">1</span> <span style="color: #008080;">do</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">di</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">digits</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">]+</span><span style="color: #000000;">1</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">di</span><span style="color: #0000FF;"><</span><span style="color: #000000;">maxdigit</span> <span style="color: #008080;">then</span> <span style="color: #000080;font-style:italic;">-- (or 9, see below)</span>
<span style="color: #000000;">digits</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">di</span>
<span style="color: #008080;">exit</span>
Line 395:
</pre>
<small>As usual we skip the last couple of entries under pwa/p2js to avoid staring at a blank screen for ages</small>
 
If we "cheat" and only check digits 0..9 we get the same results much faster:
<pre>
4 character numeric strings that are prime in 19 bases (0.1s):
5 character numeric strings that are prime in 18 bases (1.0s):
6 character numeric strings that are prime in 18 bases (16.8s):
</pre>
 
=={{header|Raku}}==
7,806

edits