login
Characteristic function of numbers that are divisible by the product of their digits.
6

%I #16 May 06 2023 18:53:35

%S 0,1,1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,

%T 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0

%N Characteristic function of numbers that are divisible by the product of their digits.

%C a(A007602(n)) = a(A038186(n)) = 1; a(A188643(n)) = 0.

%H Reinhard Zumkeller, <a href="/A188642/b188642.txt">Table of n, a(n) for n = 0..10000</a> (corrected by _Georg Fischer_, Jan 20 2019)

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%p isA007602 := proc(n) if A007954(n) = 0 then false; else `if`(n mod A007954(n) = 0,true,false) ; end if; end proc:

%p A188642 := proc(n) if isA007602(n) then 1; else 0 ; end if ; end proc:

%p seq(A188642(n),n=0..30) ; # _R. J. Mathar_, Apr 08 2011

%t dpdQ[n_]:=Module[{idn=IntegerDigits[n]},FreeQ[idn,0]&&Mod[n,Times@@idn]==0]; Table[ If[dpdQ[n],1,0],{n,0,120}] (* _Harvey P. Dale_, May 06 2023 *)

%o (Haskell)

%o a188642 n

%o | a168046 n == 1 = 1 - signum (n `mod` a007954 n)

%o | otherwise = 0

%o a188642_list = map a188642 [0..]

%Y Cf. A007954, A168046, A188641.

%K nonn,base

%O 0

%A _Reinhard Zumkeller_, Apr 07 2011