Primes which contain only one odd digit: Difference between revisions

Content added Content deleted
(→‎{{header|jq}}: fix markdown)
Line 395: Line 395:
emit_until(. > 1000; primes_with_exactly_one_odd_digit),
emit_until(. > 1000; primes_with_exactly_one_odd_digit),


"\nThe number of primes less than 1000000 with exactly one odd digits is \(count(emit_until(. > 1000000; primes_with_exactly_one_odd_digit)))."/lang>
"\nThe number of primes less than 1000000 with exactly one odd digits is \(count(emit_until(. > 1000000; primes_with_exactly_one_odd_digit)))."</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 446: Line 446:
The number of primes less than 1000000 with exactly one odd digits is 2560.
The number of primes less than 1000000 with exactly one odd digits is 2560.
</pre>
</pre>
=== A simpler but slower solution ===
===A simpler but slower solution===
<lang jq># Input is assumed to be prime.
<lang jq># Input is assumed to be prime.
# So we only need check the other digits are all even.
# So we only need check the other digits are all even.