login
A140057
Numbers such that each decimal digit d (for all d in the range 1 <= d <= 9) occurs only in runs of length exactly d.
3
1, 22, 122, 221, 333, 1221, 1333, 3331, 4444, 13331, 14444, 22122, 22333, 33322, 44441, 55555, 122122, 122333, 133322, 144441, 155555, 221221, 221333, 223331, 224444, 333122, 333221, 444422, 555551, 666666, 1221221, 1221333, 1223331
OFFSET
1,2
COMMENTS
Number of terms less than 10^k: 1, 2, 5, 9, 16, 30, 53, 92, 163, 286, 497, 869, 1516, 2639, 4606, 8032, 13993, ..., . - Robert G. Wilson v
Number of terms of k digits: 1, 1, 3, 4, 7, 14, 23, 39, 71, 123, 211, 372, 647, 1123, 1967, 3426, 5961, ..., ; not the same as A003242. - Robert G. Wilson v
LINKS
MATHEMATICA
(* first do *) Needs["Combinatorica`"] (* then *) f[n_] := Block[{ pa=Partitions@ n, len = PartitionsP@ n, s, lst, lmt}, s = Select[Range@len, pa[[ #, 1]] < 10 &]; lst=Take[pa, {s[[1]], -1}]; lst = Flatten[ DistinctPermutations /@ lst, 1]; lmt = Length@ lst; While[lmt != 0, If[ Split[lst[[lmt]]] != Partition[lst[[lmt]], 1], lst = Delete[lst, lmt]]; lmt-- ]; Sort@ (FromDigits /@ Flatten /@ (lst /. {x_Integer -> Table[x, {x}]}))] (* Robert G. Wilson v, May 25 2008 *)
Select[Range[1250000], AllTrue[Split[IntegerDigits[#]], Length[#] == #[[1]]&]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Aug 04 2019 *)
CROSSREFS
Sequence in context: A247700 A105776 A044354 * A044735 A247701 A039439
KEYWORD
base,easy,nonn
AUTHOR
Rick L. Shepherd, May 03 2008
EXTENSIONS
Definition expanded by N. J. A. Sloane, May 20 2008
STATUS
approved