%I #48 Jan 12 2024 22:43:07
%S 10,11,12,13,14,15,16,17,18,19,1011,21,1112,1113,1114,1115,1116,1117,
%T 1118,1119,1012,1112,22,1213,1214,1215,1216,1217,1218,1219,1013,1113,
%U 1213,23,1314,1315,1316,1317,1318,1319,1014,1114,1214,1314,24,1415,1416
%N Describe n (count digits in order of increasing value, ignoring missing digits).
%C Digit count of n. The digit count numerically summarizes the frequency of digits 0 through 9 in that order when they occur in a number. - _Lekraj Beedassy_, Jan 11 2007
%C Numbers which are digital permutations of one another have the same digit count. Compare with first entries of "Look And Say" or LS sequence A045918. As in the latter, a(n) has first odd-numbered-digit entry occurring at n=1111111111 with digit count 101, but a(n) has first ambiguous term 1011. For digit count invariants, i.e., n such that a(n)=n, see A047841. - _Lekraj Beedassy_, Jan 11 2007
%H Reinhard Zumkeller, <a href="/A047842/b047842.txt">Table of n, a(n) for n = 0..10000</a>
%H Onno M. Cain and Sela T. Enin, <a href="https://arxiv.org/abs/2004.00209">Inventory Loops (i.e. Counting Sequences) have Pre-period 2 max S_1 + 60</a>, arXiv:2004.00209 [math.NT], 2020.
%H Andre Kowacs, <a href="https://arxiv.org/abs/1708.06452">Studies on the Pea Pattern Sequence</a>, arXiv:1708.06452 [math.HO], 2017.
%F a(a(n)) = A235775(n). [By definition of A235775. - _M. F. Hasler_, Jan 11 2024]
%F a(A010785(n)) = A244112(A010785(n)). - _Reinhard Zumkeller_, Nov 11 2014
%F a(n) = a(A328447(n)) = a(m) for all n and all m having the same digits as n, with multiplicity. - _M. F. Hasler_, Jan 11 2024
%e a(31) = 1113 because (one 1, one 3) make up 31.
%e 101 contains one 0 and two 1's, so a(101) = 1021.
%e a(131) = 2113.
%e For n = 20231231, the digits of the date 2023-12-31, last day of 2023, a(n) = 10213223 is a fixed point: a(a(n)) = a(n) (cf. A235775). Since a(n) is invariant under permutation of the digits of n (leading zeros avoided), this is independent of the chosen notation, yyyy-mm-dd or mm/dd/yyyy or dd.mm.yyyy. - _M. F. Hasler_, Jan 11 2024
%t dc[n_] :=FromDigits@Flatten@Select[Table[{DigitCount[n, 10, k], k}, {k, 0, 9}], #[[1]] > 0 &];Table[dc[n], {n, 0, 46}] (* _Ray Chandler_, Jan 09 2009 *)
%t Array[FromDigits@ Flatten@ Map[Reverse, Tally@ Sort@ IntegerDigits@ #] &, 46] (* _Michael De Vlieger_, Jul 15 2020 *)
%o (Haskell)
%o import Data.List (sort, group); import Data.Function (on)
%o a047842 :: Integer -> Integer
%o a047842 n = read $ concat $
%o zipWith ((++) `on` show) (map length xs) (map head xs)
%o where xs = group $ sort $ map (read . return) $ show n
%o -- _Reinhard Zumkeller_, Jan 15 2014
%o (Python)
%o def A047842(n):
%o s, x = '', str(n)
%o for i in range(10):
%o y = str(i)
%o c = str(x.count(y))
%o if c != '0':
%o s += c+y
%o return int(s) # _Chai Wah Wu_, Jan 03 2015
%o (PARI) A047842(n)={if(n, local(c=1, S="", d=vecsort(digits(n)), a(i)=Str(S, c, d[i])); for(i=2, #d, if(d[i]==d[i-1], c++, S=a(i-1); c=1)); eval(a(#d)), 10)} \\ _M. F. Hasler_, Feb 25 2018; edited Jan 10 2024
%Y Cf. A005151, A047841, A047843, A127354, A127355.
%Y Cf. A235775.
%Y Cf. A244112 (the same but in order of decreasing value of digits), A010785.
%Y Cf. A005150 (Look and Say: describe the number digit-wise instead of overall count).
%Y Cf. A328447 (least m having the same digits as n).
%K nonn,easy,base,nice
%O 0,1
%A _N. J. A. Sloane_
%E Edited by _N. J. A. Sloane_, Jul 03 2008 at the suggestion of _R. J. Mathar_