login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A120004
Number of distinct numbers as substrings of n in decimal representation.
8
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 4, 5, 5, 5, 5
OFFSET
0,11
COMMENTS
a(n) = A079790(n) for n <= 100;
a(A120005(n)) = n and a(m) < n for m < A120005(n).
a(n) = length of n-th row in A218978; see also A154771. - Reinhard Zumkeller, Nov 10 2012
LINKS
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
Cf. A119999.
Sequence in context: A142246 A080428 A343886 * A079790 A098726 A065801
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