Positive decimal integers with the digit 1 occurring exactly twice: Difference between revisions
Content added Content deleted
(→{{header|Euler}}: Replace with generative, non-sorted version inspired by the Arturo, F# etc, samples) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 826: | Line 826: | ||
</pre> |
</pre> |
||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby">p (1..1000).select{|n| n.digits.count(1) == 2} |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
[11, 101, 110, 112, 113, 114, 115, 116, 117, 118, 119, 121, 131, 141, 151, 161, 171, 181, 191, 211, 311, 411, 511, 611, 711, 811, 911] |
|||
</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<syntaxhighlight lang="ruby">say (1..1000 -> grep { .digits.count { _ == 1 } == 2 })</syntaxhighlight> |
<syntaxhighlight lang="ruby">say (1..1000 -> grep { .digits.count { _ == 1 } == 2 })</syntaxhighlight> |