login
Numbers k with all digits distinct and nonzero, such that none of k's digits divide k, but all the nonzero digits not in k do divide k.
2

%I #32 Jul 10 2021 00:18:16

%S 5936,45798,45978,47598,47958,49578,49758,54798,57894,58794,58974,

%T 59478,59836,59874,74598,74958,75498,78594,78954,79458,79854,85794,

%U 87594,87954,89574,94578,94758,95478,95874,97458,97854,98754,346598,358694

%N Numbers k with all digits distinct and nonzero, such that none of k's digits divide k, but all the nonzero digits not in k do divide k.

%C From _Michael S. Branicky_, Jul 06 2021: (Start)

%C No term contains 1 as a digit.

%C If 0 were allowed as a digit, then there would be 106104 terms, starting with 0, 5936, 9780, 37960, 45798 and ending with 987654203. (End)

%D Rodolfo Kurchan, Snark, December 2007

%H Michael S. Branicky, <a href="/A133598/b133598.txt">Table of n, a(n) for n = 1..13272</a> (terms 1..100 from Rodolfo Kurchan)

%e 5936 is because 5936 is not divisible by 3, 5, 6 or 9 and is divisible by 1, 2, 4, 7 and 8.

%t addQ[n_]:=Module[{idn=IntegerDigits[n]},FreeQ[idn,0]&&Max[DigitCount[ n]] == 1&&Union[Divisible[n,idn]]=={False}&&And@@Divisible[n,Complement[ Range[ 9],idn]]]; Select[Range[400000],addQ] (* _Harvey P. Dale_, Oct 25 2017 *)

%o (Python)

%o def ok(n):

%o s = str(n); ss = set(s)

%o return '0' not in ss and len(s) == len(ss) and all(n%int(d) for d in ss) and all(n%int(d) == 0 for d in set("123456789")-ss)

%o answer2 = list(filter(ok, range(N))) # _Michael S. Branicky_, Jul 06 2021

%o (Python) # generates entire sequence

%o from sympy.utilities.iterables import multiset_permutations

%o def agen():

%o for digits in range(1, 10):

%o for mp in multiset_permutations("123456789", digits):

%o n, mpc = int("".join(mp)), set("123456789") - set(mp)

%o if all(n%int(d) for d in mp) and all(n%int(d) == 0 for d in mpc):

%o yield n

%o print([an for an in agen()]) # _Michael S. Branicky_, Jul 06 2021

%Y Cf. A133606.

%K nonn,base,fini,full

%O 1,1

%A _Rodolfo Kurchan_, Dec 27 2007

%E Name clarified by _Tanya Khovanova_, Jul 06 2021