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

Added Sidef
m (→‎slightly faster: duplicate line)
(Added Sidef)
Line 836:
<pre> 15,317 59,177 83,731 119,911 183,347 192,413 1,819,231 2,111,317 2,237,411 3,129,361
5,526,173 11,610,313 13,436,683 13,731,373 13,737,841 13,831,103 15,813,251 17,692,313 19,173,071 28,118,827</pre>
 
=={{header|Sidef}}==
<lang ruby>var e = Enumerator({|f|
 
var c = (9.primorial)
var a = (1..c -> grep { .is_coprime(c) })
 
loop {
var n = a.shift
 
a.push(n + c)
n.is_composite || next
 
f(n) if n.factor.all {|p| Str(n).contains(p) }
}
})
 
var count = 10
 
e.each {|n|
say n
break if (--count <= 0)
}</lang>
{{out}}
<pre>
15317
59177
83731
119911
183347
192413
1819231
2111317
2237411
3129361
</pre>
 
=={{header|Wren}}==
2,747

edits