Primes which contain only one odd digit: Difference between revisions
Primes which contain only one odd digit (view source)
Revision as of 01:26, 10 April 2022
, 2 years ago→{{header|Sidef}}: minor optimizations
Alextretyak (talk | contribs) m (→{{header|11l}}) |
m (→{{header|Sidef}}: minor optimizations) |
||
Line 880:
=={{header|Sidef}}==
<lang ruby>func primes_with_one_odd_digit(upto, base = 10) {
upto = prev_prime(upto+1)
var list = []
Line 889 ⟶ 891:
list << digits.grep { .is_odd && .is_prime && !.is_coprime(base) }...
for k in (0 .. upto.
even_digits.variations_with_repetition(k, {|*a|
next if (a.last == 0)
odd_digits.each {|d|
var n =
list << n if (n.is_prime && (n <= upto))
}
})
|