OFFSET
0,11
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
EXAMPLE
n=101: {'1','0','10','01','101'} -> a(101) = #{0,1,10,101} = 4;
n=102: {'1','0','2','10','02','102'} -> a(102) = #{0,1,2,10,102} = 5.
MATHEMATICA
a[n_] := Length@ DeleteDuplicates[FromDigits /@ Rest@ Subsequences[ IntegerDigits[n]]]; Array[a, 100, 0] (* Amiram Eldar, Oct 19 2021 *)
PROG
(Haskell)
import Data.List (isInfixOf)
a120004 n = sum $ map (fromEnum . (`isInfixOf` show n) . show) [0..n]
-- Reinhard Zumkeller, Jul 16 2012, Aug 14 2011
(PARI) a(n) = if (n==0, return (1)); my(d=digits(n), list=List()); for (k=1, #d, for (j=1, #d-k+1, my(dk=vector(j, i, d[k+i-1])); listput(list, fromdigits(dk)); ); ); #Set(list); \\
(Python)
def A120004(n):
s = str(n)
m = len(s)
return len(set(int(s[i:j]) for i in range(m) for j in range(i+1, m+1))) # Chai Wah Wu, Oct 19 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Jun 15 2006
EXTENSIONS
Offset changed and a(0)=1 inserted, in consequence of Zak Seidov's correction in A120005. - Reinhard Zumkeller, May 30 2010
STATUS
approved