Composite numbers k with no single digit factors whose factors are all substrings of k: Difference between revisions

Set the number of results to 20 as required.
(Created Nim solution.)
(Set the number of results to 20 as required.)
Line 353:
We use a sieve to build a list of prime factors. This is more efficient than computing the list of prime factors on the fly.
 
To find the 2520 first elements of the sequence, the program takes aboutless 23than 10 seconds on an Intel Core I5-8250U 4×1.6GHz.
<syntaxhighlight lang="Nim">import std/[strformat, strutils]
 
Line 372:
primeFactors(k).add n
 
const N = 2520 # Number of results.
var n = 11 * 11
var count = 0
Line 407:
19: 19_173_071
20: 28_118_827
21: 31_373_137
22: 47_458_321
23: 55_251_877
24: 62_499_251
25: 79_710_361
</pre>
 
256

edits