login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A354081
Positive integers k such that the first digit of k is divisible by the product of all the remaining digits of k.
0
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, 82, 84, 88, 91, 93, 99, 111, 211, 212, 221, 311, 313, 331, 411, 412, 414, 421, 422, 441, 511, 515, 551, 611, 612, 613, 616, 621, 623, 631, 632, 661, 711, 717, 771
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
Subsequence of A052382.
Sequence in context: A038724 A106001 A161390 * A096106 A321990 A076641
KEYWORD
nonn,base
AUTHOR
Moosa Nasir, Jun 05 2022
STATUS
approved