OFFSET
1,2
EXAMPLE
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.
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.
MATHEMATICA
Select[Range[1000], !MemberQ[d = IntegerDigits[#], 0] && Divisible[First[d], Times @@ Rest[d]] &] (* Amiram Eldar, Jun 09 2022 *)
PROG
(C#)
public static bool a(int n)
{
int product = 1;
while (n > 9)
{
product *= n % 10;
n /= 10;
if (product == 0 || product > 9) { return false; }
}
if (n % product == 0) { return true; } else { return false; }
}
(PARI) isok(k) = my(d=digits(k), p=vecprod(d)); p && ((d[1] % (p/d[1])) == 0); \\ Michel Marcus, Jun 06 2022
(Python)
from math import prod
def ok(n):
d = list(map(int, str(n)))
return 0 not in d and int(d[0])%prod(d[1:]) == 0
print([k for k in range(800) if ok(k)]) # Michael S. Branicky, Jun 09 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Moosa Nasir, Jun 05 2022
STATUS
approved