This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A120004 #30 Oct 19 2021 13:22:52 %S A120004 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, %T A120004 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, %U A120004 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 %N A120004 Number of distinct numbers as substrings of n in decimal representation. %C A120004 a(n) = A079790(n) for n <= 100; %C A120004 a(A120005(n)) = n and a(m) < n for m < A120005(n). %C A120004 a(n) = length of n-th row in A218978; see also A154771. - _Reinhard Zumkeller_, Nov 10 2012 %H A120004 Reinhard Zumkeller, <a href="/A120004/b120004.txt">Table of n, a(n) for n = 0..10000</a> %e A120004 n=101: {'1','0','10','01','101'} -> a(101) = #{0,1,10,101} = 4; %e A120004 n=102: {'1','0','2','10','02','102'} -> a(102) = #{0,1,2,10,102} = 5. %t A120004 a[n_] := Length@ DeleteDuplicates[FromDigits /@ Rest@ Subsequences[ IntegerDigits[n]]]; Array[a, 100, 0] (* _Amiram Eldar_, Oct 19 2021 *) %o A120004 (Haskell) %o A120004 import Data.List (isInfixOf) %o A120004 a120004 n = sum $ map (fromEnum . (`isInfixOf` show n) . show) [0..n] %o A120004 -- _Reinhard Zumkeller_, Jul 16 2012, Aug 14 2011 %o A120004 (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); \\ %o A120004 (Python) %o A120004 def A120004(n): %o A120004 s = str(n) %o A120004 m = len(s) %o A120004 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 %Y A120004 Cf. A119999. %K A120004 nonn,base %O A120004 0,11 %A A120004 _Reinhard Zumkeller_, Jun 15 2006 %E A120004 Offset changed and a(0)=1 inserted, in consequence of Zak Seidov's correction in A120005. - _Reinhard Zumkeller_, May 30 2010