A038769 Number of digits of n which are divisors of n.
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 0, 2, 1, 1, 0, 1, 0, 1, 1, 1, 2, 0, 1, 2, 0, 0, 1, 1, 1, 1, 0, 2, 1, 0, 0, 2, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 2, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 2, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 2, 1, 2, 2, 1, 2, 2
Offset: 1
Examples
a(35)=1 because 5 is a divisor of 35 but 3 is not.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
import Data.Char (digitToInt) a038769 n = length $ filter (== 0) $ map ((mod n) . digitToInt) $ filter (> '0') $ show n -- Reinhard Zumkeller, Jun 19 2011
-
Magma
[#[c:c in Intseq(k) |not IsZero(c) and k mod c eq 0]:k in [1..105]]; // Marius A. Burtea, Dec 23 2019
-
Maple
f:= proc(n) local L; L:= convert(n,base,10); nops(select(t -> t > 0 and n mod t = 0, L)) end proc: map(f, [$1..1000]); # Robert Israel, Jul 04 2016
-
Mathematica
Array[Count[Position[Most@ DigitCount@ #, ?(# > 0 &)][[All, 1]], k /; Mod[#, k] == 0] &, 105] (* Michael De Vlieger, Dec 23 2019 *) Table[Count[n/Select[IntegerDigits[n],#>0&],?IntegerQ],{n,110}] (* _Harvey P. Dale, Mar 04 2023 *)
Comments