2
\$\begingroup\$

This question already has an answer here:

A natural number (written in the decimal base) is qualified as digisible if and only if it fulfills the following 3 conditions:

  1. none of its digits is zero,
  2. all the digits that compose it are different,
  3. the number is divisible by all the digits that compose it.

The challenge is to output all the digisibles (there are 548 digisibles).

Examples

1         --> the smallest digisible
24        --> is digisible
2789136   --> is digisible
2978136   --> is digisible
2983176   --> is digisible
3298176   --> is digisible
3678192   --> is digisible
3867192   --> is digisible
3928176   --> is digisible
6387192   --> is digisible
7829136   --> is digisible
7836192   --> is digisible
7892136   --> is digisible
7892136   --> is digisible
9867312   --> the biggest digisible

1653724   --> is not digisible
1753924   --> is not digisible
23        --> is not digisible
2489167   --> is not digisible
5368192   --> is not digisible
60        --> is not digisible
7845931   --> is not digisible
8964237   --> is not digisible
9129      --> is not digisible

Input

No input.

Output

The list (or set) of all digisibles. The output does not have to be sorted.

Complete output

1
2
3
4
5
6
7
8
9
12
15
24
36
48
124
126
128
132
135
162
168
175
184
216
248
264
312
315
324
384
396
412
432
612
624
648
672
728
735
784
816
824
864
936
1236
1248
1296
1326
1362
1368
1395
1632
1692
1764
1824
1926
1935
1962
2136
2184
2196
2316
2364
2436
2916
3126
3162
3168
3195
3216
3264
3276
3492
3612
3624
3648
3816
3864
3915
3924
4128
4172
4236
4368
4392
4632
4872
4896
4932
4968
6132
6192
6312
6324
6384
6432
6912
6984
8136
8496
8736
9126
9135
9162
9216
9315
9324
9432
9612
9648
9864
12384
12648
12768
12864
13248
13824
13896
13968
14328
14728
14832
16248
16824
17248
18264
18432
18624
18936
19368
21384
21648
21784
21864
23184
24168
24816
26184
27384
28416
29736
31248
31824
31896
31968
32184
34128
36792
37128
37296
37926
38472
39168
39816
41328
41832
42168
42816
43128
43176
46128
46872
48216
48312
61248
61824
62184
64128
68712
72184
73164
73248
73416
73962
78624
79128
79632
81264
81432
81624
81936
82416
84216
84312
84672
87192
89136
89712
91368
91476
91728
92736
93168
93816
98136
123648
123864
123984
124368
126384
129384
132648
132864
132984
134928
136248
136824
138264
138624
139248
139824
142368
143928
146328
146832
148392
148632
149328
149832
162384
163248
163824
164328
164832
167328
167832
168432
172368
183264
183624
184392
184632
186432
189432
192384
193248
193824
194328
194832
198432
213648
213864
213984
214368
216384
218736
219384
231648
231864
231984
234168
234816
236184
238416
239184
241368
243168
243768
243816
247968
248136
248976
261384
263184
273168
281736
283416
284136
291384
293184
297864
312648
312864
312984
314928
316248
316824
318264
318624
319248
319824
321648
321864
321984
324168
324816
326184
328416
329184
341928
342168
342816
346128
348192
348216
348912
349128
361248
361824
361872
362184
364128
364728
367248
376824
381264
381624
382416
384192
384216
384912
391248
391824
392184
394128
412368
413928
416328
416832
418392
418632
419328
419832
421368
423168
423816
427896
428136
428736
431928
432168
432768
432816
436128
438192
438216
438912
439128
461328
461832
463128
468312
469728
478296
478632
481392
481632
482136
483192
483216
483672
483912
486312
489312
491328
491832
493128
498312
612384
613248
613824
613872
614328
614832
618432
621384
623184
623784
627984
631248
631824
632184
634128
634872
641328
641832
643128
648312
671328
671832
681432
684312
689472
732648
732816
742896
746928
762384
768432
783216
789264
796824
813264
813624
814392
814632
816432
819432
823416
824136
824376
831264
831624
832416
834192
834216
834912
836472
841392
841632
842136
843192
843216
843912
846312
849312
861432
864312
873264
891432
894312
897624
912384
913248
913824
914328
914832
918432
921384
923184
927864
931248
931824
932184
934128
941328
941832
943128
948312
976248
978264
981432
984312
1289736
1293768
1369872
1372896
1376928
1382976
1679328
1679832
1687392
1738296
1823976
1863792
1876392
1923768
1936872
1982736
2137968
2138976
2189376
2317896
2789136
2793168
2819376
2831976
2931768
2937816
2978136
2983176
3186792
3187296
3196872
3271968
3297168
3298176
3619728
3678192
3712968
3768912
3796128
3816792
3817296
3867192
3869712
3927168
3928176
6139728
6379128
6387192
6389712
6391728
6719328
6719832
6731928
6893712
6913872
6971328
6971832
7168392
7198632
7231896
7291368
7329168
7361928
7392168
7398216
7613928
7639128
7829136
7836192
7839216
7861392
7863912
7891632
7892136
7916328
7916832
7921368
8123976
8163792
8176392
8219736
8312976
8367912
8617392
8731296
8796312
8912736
8973216
9163728
9176328
9176832
9182376
9231768
9237816
9278136
9283176
9617328
9617832
9678312
9718632
9723168
9781632
9782136
9812376
9867312

Rules

  • The output can be given in any convenient format.
  • Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
  • If possible, please include a link to an online testing environment so other people can try out your code!
  • Standard loopholes are forbidden.
  • This is so all usual golfing rules apply, and the shortest code (in bytes) wins.
\$\endgroup\$

marked as duplicate by flawr code-golf Dec 31 '18 at 10:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ @Fatalize question updated \$\endgroup\$ – mdahmoune Dec 31 '18 at 10:24
  • \$\begingroup\$ May we instead output a digisible mask for all numbers up to ten million? \$\endgroup\$ – Adám Dec 31 '18 at 10:25
  • \$\begingroup\$ @Adám what do you mean by mask? \$\endgroup\$ – mdahmoune Dec 31 '18 at 10:25
  • \$\begingroup\$ 1,1,1,1,1,1,1,1,1,0,0,1,… \$\endgroup\$ – Adám Dec 31 '18 at 10:26
  • 1
    \$\begingroup\$ @Okx The top comment links to a duplicate of this question here. \$\endgroup\$ – flawr Dec 31 '18 at 10:47
1
\$\begingroup\$

Charcoal, 28 23 bytes

ΦEXχ⁷Iι∧Πι¬Φι∨⁻μ⌕ιλ﹪κIλ

Try it online! for numbers of up to five digits (too slow for larger numbers). Explanation:

   χ                    Predefined variable 10
  X                     Raised to power
    ⁷                   Literal 7
 E                      Map over implicit range
      ι                 Current value
     I                  Cast to string
Φ                       Filter over list of strings
         ι              Current string
        Π               Digital product (is nonzero)
       ∧                Logical And
          ¬             Logical Not
            ι           Current string
           Φ            Filter over digits as characters
               μ         Inner index
              ⁻          Minus
                ⌕        First position of
                  λ      Current character in
                 ι       Current string
             ∨          Logical Or
                    κ   Outer index
                   ﹪    Modulo
                      λ Current character
                     I  Cast to integer
\$\endgroup\$
  • \$\begingroup\$ @mdahmoune Sorry for the delay; while writing it up I came up with some golfs. \$\endgroup\$ – Neil Dec 31 '18 at 10:53
1
\$\begingroup\$

Python 3, 132 bytes

for i in range(1,int(1e7)):
 if '0' not in str(i) and len(set(str(i)))==len(str(i)) and not any([i%int(j) for j in str(i)]):print(i)

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Some trivial golfs \$\endgroup\$ – Mr. Xcoder Dec 31 '18 at 10:55
  • \$\begingroup\$ @Mr.Xcoder I noticed most of them after posting but I didn't edit the post after the question got locked. \$\endgroup\$ – betseg Dec 31 '18 at 11:22
1
\$\begingroup\$

Haskell, 83 bytes

-1 byte thanks to @Laikoni, -13 bytes thanks to @H.PWiz!

f=[n|n<-[1..10^7],x<-[show n],and[d>'0'&&n`mod`read[d]<1|d<-x],[a|a<-x,b<-x,a==b]==x]

Try it online!

\$\endgroup\$
  • \$\begingroup\$ notElem is in Prelude and saves a byte. \$\endgroup\$ – Laikoni Jan 1 at 17:28
  • \$\begingroup\$ Shorter than notElem '0' is all(/='0'). You can also use x<-[show n] \$\endgroup\$ – H.PWiz Jan 2 at 0:12
  • \$\begingroup\$ I've found some more golfs \$\endgroup\$ – H.PWiz Jan 2 at 0:25
  • \$\begingroup\$ @H.PWiz Thanks a lot! \$\endgroup\$ – flawr Jan 2 at 10:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.