login
Number of distinct digits needed to write all positive divisors of n in decimal representation.
15

%I #22 Nov 16 2022 14:53:54

%S 1,2,2,3,2,4,2,4,3,4,1,5,2,4,3,5,2,6,2,5,4,2,3,6,3,4,5,5,3,6,2,6,2,5,

%T 4,7,3,5,3,6,2,6,3,3,5,5,3,6,4,4,4,6,3,9,2,7,5,5,3,7,2,4,6,6,4,4,3,7,

%U 5,7,2,8,3,5,5,8,2,7,3,7,6,4,3,7,4,6,6,4,3,9,4,6,3,5,3,7,3,6,3,5,2,8

%N Number of distinct digits needed to write all positive divisors of n in decimal representation.

%C a(n) <= 10, a(A095050(n)) = 10.

%C a(A206159(n)) <= 2. - _Reinhard Zumkeller_, Feb 05 2012

%C Almost all (in the sense of natural density) terms of this sequence are equal to 10. - _Charles R Greathouse IV_, Nov 16 2022

%H Reinhard Zumkeller, <a href="/A095048/b095048.txt">Table of n, a(n) for n = 1..10000</a>

%e Set of divisors of n=10: {1,2,5,10}, therefore a(10) = #{0,1,2,5} = 4.

%e Set of divisors of n=16: {1,2,4,8,16}, therefore a(16)=#{1,2,4,6,8} = 5.

%p A095048 := proc(n)

%p local digset ;

%p digset := {} ;

%p for d in numtheory[divisors](n) do

%p digset := digset union convert(convert(d,base,10),set) ;

%p end do:

%p nops(digset) ;

%p end proc:

%p seq(A095048(n),n=1..80) ; # _R. J. Mathar_, May 13 2022

%o (Haskell)

%o import Data.List (group, sort)

%o a095048 = length . group . sort . concatMap show . a027750_row

%o -- _Reinhard Zumkeller_, Feb 05 2012

%o (Python)

%o from sympy import divisors

%o def a(n):

%o s = set("1"+str(n))

%o if len(s) == 10: return 10

%o for d in divisors(n, generator=True):

%o s |= set(str(d))

%o if len(s) == 10: return 10

%o return len(s)

%o print([a(n) for n in range(1, 99)]) # _Michael S. Branicky_, Nov 16 2022

%o (PARI) a(n) = my(d = divisors(n), s = 0); for(i = 1, #d, v = digits(d[i]); for(j = 1, #v, s = bitor(s, 1<<v[j]); if(s == 1023, return(10)))); hammingweight(s) \\ _David A. Corneth_, Nov 16 2022

%Y Cf. A095049, A095050, A043537.

%Y Cf. A027750, A059436.

%K nonn,base

%O 1,2

%A _Reinhard Zumkeller_, May 28 2004