A095048 Number of distinct digits needed to write all positive divisors of n in decimal representation.
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, 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, 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
Offset: 1
Examples
Set of divisors of n=10: {1,2,5,10}, therefore a(10) = #{0,1,2,5} = 4. Set of divisors of n=16: {1,2,4,8,16}, therefore a(16)=#{1,2,4,6,8} = 5.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
import Data.List (group, sort) a095048 = length . group . sort . concatMap show . a027750_row -- Reinhard Zumkeller, Feb 05 2012
-
Maple
A095048 := proc(n) local digset ; digset := {} ; for d in numtheory[divisors](n) do digset := digset union convert(convert(d,base,10),set) ; end do: nops(digset) ; end proc: seq(A095048(n),n=1..80) ; # R. J. Mathar, May 13 2022
-
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<
David A. Corneth, Nov 16 2022 -
Python
from sympy import divisors def a(n): s = set("1"+str(n)) if len(s) == 10: return 10 for d in divisors(n, generator=True): s |= set(str(d)) if len(s) == 10: return 10 return len(s) print([a(n) for n in range(1, 99)]) # Michael S. Branicky, Nov 16 2022
Comments