login
Number of n-digit numbers N with distinct digits such that the reversal of N divides N.
7

%I #30 Dec 15 2024 19:52:31

%S 9,9,3,5,3,2,0,0,0

%N Number of n-digit numbers N with distinct digits such that the reversal of N divides N.

%C Suggested by A214927.

%C a(n)=0 for all n > 6.

%e Solutions with 1 through 6 digits:

%e [1, 2, 3, 4, 5, 6, 7, 8, 9],

%e [10, 20, 30, 40, 50, 60, 70, 80, 90],

%e [510, 540, 810],

%e [5610, 5940, 8712, 8910, 9801],

%e [65340, 87120, 87912],

%e [659340, 879120],

%o (Python)

%o import collections

%o col = []

%o count = 0

%o for n in range(0, 9):

%o a = 10**n

%o stop = 10**(n+1)

%o while a < stop:

%o b = str(a)

%o c = list(b)

%o d = c[::-1]

%o e = int("".join(c))

%o f = int("".join(d))

%o counter = collections.Counter(c)

%o if e % f == 0 and counter.most_common(1)[0][1] == 1:

%o count += 1

%o col.append(a)

%o a += 1

%o print(n+1, " digits: ", count, " elements: ", col)

%o count = 0

%o col = []

%o # _David Consiglio, Jr._, Dec 04 2014

%Y Cf. A214927, A222809, A222811, A222812.

%Y For the actual numbers see A223080.

%K nonn,base

%O 1,1

%A _N. J. A. Sloane_, Mar 10 2013

%E a(8)-a(9) from _David Consiglio, Jr._, Dec 04 2014