cp's OEIS Frontend

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.

Showing 1-6 of 6 results.

A319744 Partial sums of bouncy numbers (A152054).

Original entry on oeis.org

101, 203, 306, 410, 515, 621, 728, 836, 945, 1065, 1186, 1316, 1447, 1579, 1719, 1860, 2002, 2145, 2295, 2446, 2598, 2751, 2905, 3065, 3226, 3388, 3551, 3715, 3880, 4050, 4221, 4393, 4566, 4740, 4915, 5091, 5271, 5452, 5634, 5817, 6001, 6186, 6372, 6559, 6749, 6940, 7132, 7325, 7519
Offset: 1

Views

Author

David F. Marrs, Oct 21 2018

Keywords

Examples

			a(1) = 101.
a(2) = 101 + 102 = 203.
a(10) = 101 + 102 + 103 + 104 + 105 + 106 + 107 + 108 + 109 + 120 = 1065.
		

Crossrefs

Cf. A152054 (bouncy numbers).

Programs

  • Python
    for n in range(50):
      a = n
      b = 0
      c = 0
      while a:
        if ''.join(sorted(str(b))) != str(b) and ''.join(sorted(str(b)))[::-1] != str(b): c += b; a -= 1
        b += 1
      print(c)
    
  • Python
    from itertools import count, islice
    def A319744_gen(): # generator of terms
        c = 0
        for n in count(101):
            l = len(s:=tuple(int(d) for d in str(n)))
            for i in range(1,l-1):
                if (s[i-1]-s[i])*(s[i]-s[i+1]) < 0:
                    c += n
                    yield c
                    break
    A319744_list = list(islice(A319744_gen(),30)) # Chai Wah Wu, Jul 28 2023

A009994 Numbers with digits in nondecreasing order.

Original entry on oeis.org

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, 29, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 66, 67, 68, 69, 77, 78, 79, 88, 89, 99, 111, 112, 113, 114, 115, 116, 117, 118, 119, 122
Offset: 1

Views

Author

Keywords

Comments

Record values and occurrences of A004185. - Reinhard Zumkeller, Dec 05 2009
A193581(a(n)) = 0. - Reinhard Zumkeller, Aug 10 2011
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

References

  • Amarnath Murthy and Robert J. Clarke, Some Properties of Staircase sequence, Mathematics & Informatics Quarterly, Volume 11, No. 4, November 2001.
  • Frank A. Hanna, The Compilation of Manufacturing Statistics. U.S. Department of Commerce, Bureau of the Census, 1959.

Crossrefs

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

Programs

  • Haskell
    import Data.Set (fromList, deleteFindMin, insert)
    a009994 n = a009994_list !! n
    a009994_list = 0 : f (fromList [1..9]) where
       f s = m : f (foldl (flip insert) s' $ map (10*m +) [m `mod` 10 ..9])
             where (m,s') = deleteFindMin s
    -- Reinhard Zumkeller, Aug 10 2011
    
  • Magma
    [k:k in [0..122]|Sort(Intseq(k)) eq Reverse(Intseq(k))]; // Marius A. Burtea, Jul 28 2019
    
  • Maple
    A[0]:= [0]: A[1]:= [$1..9]:
    for d from 2 to 4 do
      A[d]:= map(t -> seq(10*t+i,i=(t mod 10) .. 9), A[d-1]):
    od:
    seq(op(A[d]),d=0..4); # Robert Israel, Jul 28 2019
  • Mathematica
    Select[Range[0, 125], LessEqual@@IntegerDigits[#] &] (* Ray Chandler, Oct 25 2011 *)
  • PARI
    is(n)=n=digits(n);n==vecsort(n) \\ Charles R Greathouse IV, Dec 03 2013
    
  • Python
    from itertools import combinations_with_replacement
    def A009994generator():
        yield 0
        l = 1
        while True:
            for i in combinations_with_replacement('123456789',l):
                yield int(''.join(i))
            l += 1 # Chai Wah Wu, Nov 11 2015
    
  • Scala
    def hasDigitsSorted(n: Int): Boolean = {
      val digSort = Integer.parseInt(n.toString.toCharArray.sorted.mkString)
      n == digSort
    }
    (0 to 200).filter(hasDigitsSorted()) // _Alonso del Arte, Apr 20 2020

Formula

a(n) >> exp(n^(1/10)). - Charles R Greathouse IV, Mar 15 2014
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

A009996 Numbers with digits in nonincreasing order.

Original entry on oeis.org

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, 52, 53, 54, 55, 60, 61, 62, 63, 64, 65, 66, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 110, 111, 200, 210, 211
Offset: 1

Views

Author

Keywords

Comments

Base-10 representation Sum_{i=0..m} d(i)*10^i has d(m) >= d(m-1) >= ... >= d(1) >= d(0).
These numbers might be called "Nialpdromes".
A004186(a(n)) = a(n). - Reinhard Zumkeller, Oct 31 2007

Examples

			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.
		

Crossrefs

Differs from A032873 and A032907.

Programs

  • Mathematica
    Select[Range[0,211], GreaterEqual@@IntegerDigits[#]&] (* Ray Chandler, Oct 25 2011 *)
  • 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
    
  • PARI
    \\ This program is optimized for fast calculation of a(n) for large n.
    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
    
  • PARI
    \\recursive--feed an element a(n)>0 and it gives a(n+1).
    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
    
  • Python
    from itertools import count, islice, combinations_with_replacement as mc
    def agen(): # generator of terms
        yield 0
        for d in count(1):
            ni = (int("".join(m)) for m in mc("9876543210", d) if m[0]!="0")
            yield from sorted(ni)
    print(list(islice(agen(), 70))) # Michael S. Branicky, Jun 24 2022

Formula

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.

Extensions

Corrected by Rick L. Shepherd, Jun 06 2002

A204692 a(n) is the number of base-10 bouncy numbers below 10^n.

Original entry on oeis.org

0, 0, 525, 8325, 95046, 987048, 9969183, 99932013, 999859093, 9999722967, 99999479435, 999999059545, 9999998358645, 99999997221695, 999999995423887, 9999999992645451, 99999999988439336, 999999999982190246, 9999999999973063281, 99999999999959940181, 999999999999941340896
Offset: 1

Views

Author

Thomas Quirk, Jan 18 2012

Keywords

Comments

A bouncy number has digits that are neither monotonically increasing nor decreasing from left to right.

Examples

			a(3) = 525 because there are 525 base-10 bouncy numbers < 10^3; the smallest is A152054(1) = 101 and the largest one is A152054(525) = 989.
a(4) = 8325 because A152054(8325) = 9989 is the largest base-10 bouncy number < 10^4.
		

Crossrefs

Cf. A152054.

Programs

  • GAP
    a:=[0,0];; for n in [3..25] do a[n]:=10^n-(Binomial(n+10,10)+Binomial(n+9,9)-1-10*n); od; a; # Muniru A Asiru, Sep 28 2018
    
  • Magma
    [n le 2 select 0 else (10^n - Binomial(n+10, 10) - Binomial(n+9, 9) + 10*n + 1): n in [1..25]]; // G. C. Greubel, Nov 24 2018
    
  • Maple
    a:=n->`if`(n<=2,0,10^n-(binomial(n+10,10)+binomial(n+9,9)-1-10*n)); seq(a(n),n=1..25); # Muniru A Asiru, Sep 28 2018
  • Mathematica
    a[n_]:= 10^n - Binomial[n+10, 10] - Binomial[n+9, 9] + 10*n + 1; Array[a, 25] (* Stefano Spezia, Sep 29 2018 *)
  • PARI
    a(n) = if(n<3, 0, 10^n-(binomial(n+10,10)+binomial(n+9, 9)-1-10*n)); \\ Altug Alkan, Sep 27 2018
    
  • Sage
    def A204692(n):
        if n <= 2:
            return 0
        else:
            return (10^n - binomial(n+10, 10) - binomial(n+9, 9) + 10*n + 1)
    [A204692(n) for n in (1..25)] # G. C. Greubel, Nov 24 2018

Formula

a(1) = a(2) = 0. For n > 2, a(n) = 10^n - binomial(n+9, n) + 10*n - Sum_{i=1..n} binomial(i+9, i) = 10^n - binomial(n+10, 10) - binomial(n+9, 9) + 10*n + 1. [Corrected by Altug Alkan, Sep 28 2018]
From Chai Wah Wu, Jul 28 2023: (Start)
a(n) = 21*a(n-1) - 165*a(n-2) + 715*a(n-3) - 1980*a(n-4) + 3762*a(n-5) - 5082*a(n-6) + 4950*a(n-7) - 3465*a(n-8) + 1705*a(n-9) - 561*a(n-10) + 111*a(n-11) - 10*a(n-12) for n > 12.
G.f.: x^3*(89*x^8 - 798*x^7 + 3175*x^6 - 7350*x^5 + 10890*x^4 - 10668*x^3 + 6846*x^2 - 2700*x + 525)/((x - 1)^11*(10*x - 1)). (End)

Extensions

Corrected and extended by Altug Alkan, Sep 27 2018

A152464 Number of n-digit bouncy numbers in which every pair of adjacent digits are distinct.

Original entry on oeis.org

0, 0, 525, 3105, 18939, 114381, 693129, 4195557, 25405586, 153820395, 931359050, 5639156409, 34143908573, 206733865761, 1251728824798, 7578945799704, 45888871327435, 277847147039527, 1682304127857000, 10185986079451152
Offset: 1

Views

Author

Jon E. Schoenfield, Dec 05 2008

Keywords

Comments

We might call such numbers "strictly bouncy numbers"; they exclude most n-digit "bouncy numbers" (cf. A152054) for n >= 4.
As n increases, a(n) approaches c/(2*cos(Pi*9/19))^n,
where c is 2.32290643963522604128193759601...
Is c the result of some simple expression?
From Jon E. Schoenfield, Dec 16 2008: (Start)
We could define the recursive formula
f(n) = 5*f(n-1) + 10*f(n-2) - 20*f(n-3) - 15*f(n-4) + 21*f(n-5) + 7*f(n-6) - 8*f(n-7) - f(n-8) + f(n-9)
and use a(n)=f(n) for n > 2 (a(n)=0 otherwise). Working backwards, given the terms f(11)=a(11) down through f(3)=a(3), the recursive formula would yield f(2)=81, f(1)=17 and f(0)=1, followed by the values 2, -1, 2, -2, 4, -5, 10, -14, 28, -42, 84, -132, etc., for negative values of n; these values are negative Catalan numbers for even n and twice (positive) Catalan numbers for odd n, down to f(-16).
The above results apply for numbers in base 10. In general, for base m+1 (so that the largest possible value for a digit is m), we can write
a(n) = f(n) for n > 2, 0 otherwise, where
f(n) = Sum_{j=1..m} (-1)^floor((j-1)/2)*binomial(floor((m+j)/2),j)*f(n-j) for n > 2,
f(2) = m^2, f(1) = 2*m - 1, f(0)=1,
f(n) = 2*Catalan((-1-n)/2) for odd n, 2 - 2m < n < 0 and
f(n) = -Catalan(-n/2) for even n, 2 - 2m <= n < 0.
(The expressions for n < 0 work more than far enough down to give enough terms to begin generating f(3), f(4), etc.) (End)

Crossrefs

Formula

a(n) = Sum_{i=1..9} (u(n,i) + d(n,i)) for n > 2 (0 otherwise), where
u(n,i) = Sum_{j=i+1..9} d(n-1,j) for n > 1,
d(n,i) = Sum_{j=0..i-1} u(n-1,j) for n > 1,
u(1,i) = 1, and
d(1,i) = 1.

Extensions

Correction to formula for odd negative n by Jon E. Schoenfield, Dec 22 2008

A364342 a(n) is the number of base-10 nonbouncy numbers below 10^n.

Original entry on oeis.org

10, 100, 475, 1675, 4954, 12952, 30817, 67987, 140907, 277033, 520565, 940455, 1641355, 2778305, 4576113, 7354549, 11560664, 17809754, 26936719, 40059819, 58659104, 84672094, 120609609, 169694999, 236030401, 324794055, 442473145, 597137095, 798756745, 1059575359
Offset: 1

Views

Author

Peter Cullen Burbery, Jul 19 2023

Keywords

Comments

A bouncy number has digits that are neither monotonically increasing nor decreasing from left to right. A nonbouncy number is a number that is not bouncy. That is, either the digits are monotonically increasing or they are monotonically decreasing from left to right.

Examples

			a(3) = 475 because binomial(3+9, 3) + (3+1)*binomial(3+10, 3+1)/10 - 10*3 - 1 = 475.
a(4) = 1675 because binomial(4+9, 4) + (4+1)*binomial(4+10, 4+1)/10 - 10*4 - 1 = 1675.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := -1 - 10 n + Binomial[9 + n, n] + 1/10 (1 + n) Binomial[10 + n, 1 + n]; Table[a[n], {n, 100}]

Formula

a(1) = 10, a(2) = 100. For n > 2, a(n) = binomial(n+9, n) + (n+1)*binomial(n+10, n+1)/10 - 10*n - 1.
G.f.: x*(10 - 10*x - 75*x^2 + 300*x^3 - 546*x^4 + 588*x^5 - 390*x^6 + 150*x^7 - 25*x^8 - 2*x^9 + x^10)/(1 - x)^11. - Stefano Spezia, Jul 20 2023
Showing 1-6 of 6 results.