login
Numbers with digits in nondecreasing order.
67

%I #90 Jan 02 2023 12:30:46

%S 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,

%T 29,33,34,35,36,37,38,39,44,45,46,47,48,49,55,56,57,58,59,66,67,68,69,

%U 77,78,79,88,89,99,111,112,113,114,115,116,117,118,119,122

%N Numbers with digits in nondecreasing order.

%C Record values and occurrences of A004185. - _Reinhard Zumkeller_, Dec 05 2009

%C A193581(a(n)) = 0. - _Reinhard Zumkeller_, Aug 10 2011

%C This sequence was used by the U.S. Bureau of the Census in the mid-1950s to numerically code the alphabetical list of counties within a state (with some modifications for Texas). The 3-digit code has a "self-policing element" built into it and "was fairly effective in detecting the transposition of 2 digits." (Hanna 1959). - _Randy A. Becker_, Dec 11 2017

%D Amarnath Murthy and Robert J. Clarke, Some Properties of Staircase sequence, Mathematics & Informatics Quarterly, Volume 11, No. 4, November 2001.

%D Frank A. Hanna, The Compilation of Manufacturing Statistics. U.S. Department of Commerce, Bureau of the Census, 1959.

%H Seiichi Manyama, <a href="/A009994/b009994.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Reinhard Zumkeller)

%H David Applegate, Marc LeBrun, N. J. A. Sloane, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL14/Sloane/carry2.html">Dismal Arithmetic</a>, J. Int. Seq. 14 (2011) # 11.9.8.

%H David Radcliffe and Brendan McKay, <a href="http://list.seqfan.eu/oldermail/seqfan/2019-July/018891.html">Re: A009994</a>, SeqFan list, Jul 29 2019

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Digit.html">Digit.</a>

%H <a href="/index/Ar#10-automatic">Index entries for 10-automatic sequences</a>.

%F a(n) >> exp(n^(1/10)). - _Charles R Greathouse IV_, Mar 15 2014

%F a(n) ~ 10^((9! n)^(1/9) - 5), since 10^(d - 1) <= a(n) < 10^d for binomial(d + 8, 9) < n <= binomial(d + 9, 9) = (d + 5 - epsilon)^9 / 9!. Using epsilon = 10/(3n) + o(1/n) gives more precise estimate. [Following Radcliffe and McKay, cf. SeqFan list.] - _M. F. Hasler_, Jul 30 2019

%p A[0]:= [0]: A[1]:= [$1..9]:

%p for d from 2 to 4 do

%p A[d]:= map(t -> seq(10*t+i,i=(t mod 10) .. 9), A[d-1]):

%p od:

%p seq(op(A[d]),d=0..4); # _Robert Israel_, Jul 28 2019

%t Select[Range[0, 125], LessEqual@@IntegerDigits[#] &] (* _Ray Chandler_, Oct 25 2011 *)

%o (Haskell)

%o import Data.Set (fromList, deleteFindMin, insert)

%o a009994 n = a009994_list !! n

%o a009994_list = 0 : f (fromList [1..9]) where

%o f s = m : f (foldl (flip insert) s' $ map (10*m +) [m `mod` 10 ..9])

%o where (m,s') = deleteFindMin s

%o -- _Reinhard Zumkeller_, Aug 10 2011

%o (PARI) is(n)=n=digits(n);n==vecsort(n) \\ _Charles R Greathouse IV_, Dec 03 2013

%o (Python)

%o from itertools import combinations_with_replacement

%o def A009994generator():

%o yield 0

%o l = 1

%o while True:

%o for i in combinations_with_replacement('123456789',l):

%o yield int(''.join(i))

%o l += 1 # _Chai Wah Wu_, Nov 11 2015

%o (Magma) [k:k in [0..122]|Sort(Intseq(k)) eq Reverse(Intseq(k))]; // _Marius A. Burtea_, Jul 28 2019

%o (Scala) def hasDigitsSorted(n: Int): Boolean = {

%o val digSort = Integer.parseInt(n.toString.toCharArray.sorted.mkString)

%o n == digSort

%o }

%o (0 to 200).filter(hasDigitsSorted(_)) // _Alonso del Arte_, Apr 20 2020

%Y Apart from the first term, a subsequence of A052382. A254143 is a subsequence.

%Y Cf. A152054, A036839.

%K nonn,base,look

%O 1,3

%A _N. J. A. Sloane_