Pandigital prime: Difference between revisions
→Using digits 0 to n: Sigh, no need to check 3 digit cases in fact.
(→{{header|Wren}}: Added a 0..n digit version.) |
(→Using digits 0 to n: Sigh, no need to check 3 digit cases in fact.) |
||
Line 531:
</pre>
===Using digits 0 to n===
Applying the Factor logic for the digits 0..n, we only need to check 8
<lang ecmascript>import "/math" for Int
import "/fmt" for Fmt
Line 563:
System.print("The largest pandigital decimal prime which uses all the digits 0..n once is:")
for (n in [7, 4
var perms = permutations.call((0..n).toList)
for (i in perms.count - 1..0) {
|