This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A009996 #55 Feb 16 2025 08:32:32 %S A009996 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 A009996 52,53,54,55,60,61,62,63,64,65,66,70,71,72,73,74,75,76,77,80,81,82,83, %U A009996 84,85,86,87,88,90,91,92,93,94,95,96,97,98,99,100,110,111,200,210,211 %N A009996 Numbers with digits in nonincreasing order. %C A009996 Base-10 representation Sum_{i=0..m} d(i)*10^i has d(m) >= d(m-1) >= ... >= d(1) >= d(0). %C A009996 These numbers might be called "Nialpdromes". %C A009996 A004186(a(n)) = a(n). - _Reinhard Zumkeller_, Oct 31 2007 %H A009996 Reinhard Zumkeller, <a href="/A009996/b009996.txt">Table of n, a(n) for n = 1..1000</a> %H A009996 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 A009996 David A. Corneth, <a href="/A009996/a009996.gp.txt">Table of n, a(n) for n = 1..20000</a>, Jun 03 2014 %H A009996 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Digit.html">Digit</a> %F A009996 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 A009996 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 A009996 Select[Range[0,211], GreaterEqual@@IntegerDigits[#]&] (* _Ray Chandler_, Oct 25 2011 *) %o A009996 (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 A009996 (PARI) \\ This program is optimized for fast calculation of a(n) for large n. %o A009996 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 A009996 (PARI) \\recursive--feed an element a(n)>0 and it gives a(n+1). %o A009996 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 A009996 (Python) %o A009996 from itertools import count, islice, combinations_with_replacement as mc %o A009996 def agen(): # generator of terms %o A009996 yield 0 %o A009996 for d in count(1): %o A009996 ni = (int("".join(m)) for m in mc("9876543210", d) if m[0]!="0") %o A009996 yield from sorted(ni) %o A009996 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Jun 24 2022 %Y A009996 Differs from A032873 and A032907. %Y A009996 Cf. A064222, A152054. %K A009996 nonn,base,look %O A009996 1,3 %A A009996 _N. J. A. Sloane_ %E A009996 Corrected by _Rick L. Shepherd_, Jun 06 2002