login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A009996 Numbers with digits in nonincreasing order. 30

%I #54 Jun 25 2022 02:20:59

%S 0,1,2,3,4,5,6,7,8,9,10,11,20,21,22,30,31,32,33,40,41,42,43,44,50,51,

%T 52,53,54,55,60,61,62,63,64,65,66,70,71,72,73,74,75,76,77,80,81,82,83,

%U 84,85,86,87,88,90,91,92,93,94,95,96,97,98,99,100,110,111,200,210,211

%N Numbers with digits in nonincreasing order.

%C Base-10 representation Sum_{i=0..m} d(i)*10^i has d(m) >= d(m-1) >= ... >= d(1) >= d(0).

%C These numbers might be called "Nialpdromes".

%C A004186(a(n)) = a(n). - _Reinhard Zumkeller_, Oct 31 2007

%H Reinhard Zumkeller, <a href="/A009996/b009996.txt">Table of n, a(n) for n = 1..1000</a>

%H D. Applegate, M. LeBrun, and 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 A. Corneth, <a href="/A009996/a009996.gp.txt">Table of n, a(n) for n = 1..20000</a>, Jun 03 2014

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

%F Binomial(n+k,k) = (n+k)!/(n!*k!). d(i) is the i-th digit of a(n). q is the number of digits of a(n). Find the highest m such that C(10 + m, 10) - m + 1 <= n. a(n) has m+1 digits. Set n = n - C(10+m,10). Find the highest d(m+1), then d(m), then ..., then d(1) each iteration such that C(d(m+1)+m+1,1+m+1)<=n. Then set n = n-C(d(m+1)+m+1,m+2). If n = 0 then stop. All remaining digits are 0.

%e As 10000 = C(10+6,10) - 6 + C(7+6,1+6) + C(5+5,1+5) + C(4+4,1+4) + C(3+3,1+3) + C(1+2,1+2) + C(0+1,1+1), C(0+0,1+0), a(10000) = 7543100.

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

%o (PARI) is(n)=my(d=digits(n)); for(i=2,#d,if(d[i]>d[i-1],return(0))); 1 \\ _Charles R Greathouse IV_, Jan 02 2014

%o (PARI) \\ This program is optimized for fast calculation of a(n) for large n.

%o a(n)={my(q,m=10,i,r=0);n--;while(binomial(m+1,10)<=n+m-9,m++);n-=binomial(m,10);n+=m-9;q=m-9;i=q;while(n>0,m=i;while(binomial(m+1,i)<=n,m++);r=10*r+m+1-i;n-=binomial(m,i);i--;);z=q-#digits(r);r*=10^z;r} \\ _David A. Corneth_, Jun 01 2014

%o (PARI) \\recursive--feed an element a(n)>0 and it gives a(n+1).

%o nxt(n)={my(r,d=digits(n),y,t); if(d[#d]!=9,y=1; while(y-#d-1&&d[y]==9,y++); t=#d; forstep(i=t,y+1,-1,if(d[i-1]!=d[i],t=i-1;break)); if(t!=#d,d[t+1]++; for(i=t+2,#d,d[i]=0),d[y]++; for(i=y+1,#d,d[i]=0));r=d ,d=vector(#d+1); d[1]=1;for(i=2,#d,d[i]=0); r=d); sum(i=1,#r,10^(#r-i)*r[i])} \\ _David A. Corneth_, Jun 01 2014

%o (Python)

%o from itertools import count, islice, combinations_with_replacement as mc

%o def agen(): # generator of terms

%o yield 0

%o for d in count(1):

%o ni = (int("".join(m)) for m in mc("9876543210", d) if m[0]!="0")

%o yield from sorted(ni)

%o print(list(islice(agen(), 70))) # _Michael S. Branicky_, Jun 24 2022

%Y Differs from A032873 and A032907.

%Y Cf. A064222, A152054.

%K nonn,base,look

%O 1,3

%A _N. J. A. Sloane_

%E Corrected by _Rick L. Shepherd_, Jun 06 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 8 19:26 EDT 2024. Contains 372341 sequences. (Running on oeis4.)