A217928 Sum of distinct decimal digits appearing in n.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 2, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 3, 7, 8, 9, 10, 11, 12, 4, 5, 6, 7, 4, 9, 10, 11, 12, 13, 5, 6, 7, 8, 9, 5, 11, 12, 13, 14, 6, 7, 8, 9, 10, 11, 6, 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 7, 15, 16, 8, 9, 10, 11, 12, 13, 14, 15, 8, 17, 9, 10, 11, 12, 13, 14, 15, 16, 17, 9, 1
Offset: 0
Links
Programs
-
Haskell
import Data.List (nub) a217928 = sum . nub . map (read . return) . show :: Integer -> Integer -- Reinhard Zumkeller, Jul 09 2013
-
Maple
a:= n-> add(i, i={convert(n, base, 10)[]}): seq(a(n), n=0..100); # Alois P. Heinz, Sep 21 2022
-
PARI
{ a(n) = local( d = vecsort( eval(Vec(Str(n))),,8) ); sum(i=1,#d,d[i]) }
-
PARI
a(n) = vecsum(Set(digits(n))); \\ Michel Marcus, Sep 13 2022
-
Python
def a(n): return sum(map(int, set(str(n)))) print([a(n) for n in range(101)]) # Michael S. Branicky, Sep 13 2022
Comments