OFFSET
0,1
COMMENTS
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
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
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Onno M. Cain and Sela T. Enin, Inventory Loops (i.e. Counting Sequences) have Pre-period 2 max S_1 + 60, arXiv:2004.00209 [math.NT], 2020.
Andre Kowacs, Studies on the Pea Pattern Sequence, arXiv:1708.06452 [math.HO], 2017.
FORMULA
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
EXAMPLE
a(31) = 1113 because (one 1, one 3) make up 31.
101 contains one 0 and two 1's, so a(101) = 1021.
a(131) = 2113.
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
MATHEMATICA
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 *)
Array[FromDigits@ Flatten@ Map[Reverse, Tally@ Sort@ IntegerDigits@ #] &, 46] (* Michael De Vlieger, Jul 15 2020 *)
PROG
(Haskell)
import Data.List (sort, group); import Data.Function (on)
a047842 :: Integer -> Integer
a047842 n = read $ concat $
zipWith ((++) `on` show) (map length xs) (map head xs)
where xs = group $ sort $ map (read . return) $ show n
-- Reinhard Zumkeller, Jan 15 2014
(Python)
def A047842(n):
s, x = '', str(n)
for i in range(10):
y = str(i)
c = str(x.count(y))
if c != '0':
s += c+y
return int(s) # Chai Wah Wu, Jan 03 2015
(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
CROSSREFS
KEYWORD
nonn,easy,base,nice
AUTHOR
EXTENSIONS
Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar
STATUS
approved