Numbers divisible by their individual digits, but not by the product of their digits.: Difference between revisions

(Added Sidef)
Line 857:
{{out}}
<pre>22 33 44 48 55 66 77 88 99 122 124 126 155 162 168 184 222 244 248 264 288 324 333 336 366 396 412 424 444 448 488 515 555 636 648 666 728 777 784 824 848 864 888 936 999</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<lang jq>def digits:
tostring | explode | map( [.] | implode | tonumber);
 
def prod:
reduce .[] as $i (1; .*$i);
def is_divisible_by_digits_but_not_product:
. as $n
| tostring
| select( null == index("0"))
| digits
| all( unique[]; $n % . == 0)
and ($n % prod != 0);</lang>
'''The Task'''
<lang jq>"Numbers < 1000 divisible by their digits, but not by the product thereof:",
(range(1; 1000)
| select(is_divisible_by_digits_but_not_product))</lang>
{{out}}
<pre>
Numbers < 1000 divisible by their digits, but not by the product thereof:
22
33
44
48
55
66
77
88
99
122
124
126
155
162
168
184
222
244
248
264
288
324
333
336
366
396
412
424
444
448
488
515
555
636
648
666
728
777
784
824
848
864
888
936
999
</pre>
 
 
=={{header|Julia}}==
2,451

edits