login
Positive integers k such that the first digit of k is divisible by the product of all the remaining digits of k.
0

%I #45 Jun 16 2022 03:18:43

%S 1,2,3,4,5,6,7,8,9,11,21,22,31,33,41,42,44,51,55,61,62,63,66,71,77,81,

%T 82,84,88,91,93,99,111,211,212,221,311,313,331,411,412,414,421,422,

%U 441,511,515,551,611,612,613,616,621,623,631,632,661,711,717,771

%N Positive integers k such that the first digit of k is divisible by the product of all the remaining digits of k.

%e 9331 is a term: the first digit is 9, which is divisible by the product of the remaining digits, i.e., 3*3*1 = 9.

%e 8448 is not a term: the first digit is 8, which is not divisible by the product of the remaining digits, i.e., 4*4*8 = 128.

%t Select[Range[1000], !MemberQ[d = IntegerDigits[#], 0] && Divisible[First[d], Times @@ Rest[d]] &] (* _Amiram Eldar_, Jun 09 2022 *)

%o (C#)

%o public static bool a(int n)

%o {

%o int product = 1;

%o while (n > 9)

%o {

%o product *= n % 10;

%o n /= 10;

%o if (product == 0 || product > 9) { return false; }

%o }

%o if (n % product == 0) { return true; } else { return false; }

%o }

%o (PARI) isok(k) = my(d=digits(k), p=vecprod(d)); p && ((d[1] % (p/d[1])) == 0); \\ _Michel Marcus_, Jun 06 2022

%o (Python)

%o from math import prod

%o def ok(n):

%o d = list(map(int, str(n)))

%o return 0 not in d and int(d[0])%prod(d[1:]) == 0

%o print([k for k in range(800) if ok(k)]) # _Michael S. Branicky_, Jun 09 2022

%Y Subsequence of A052382.

%K nonn,base

%O 1,2

%A _Moosa Nasir_, Jun 05 2022