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-2 of 2 results.

A152054 Bouncy numbers (numbers whose digits are in neither increasing nor decreasing order).

Original entry on oeis.org

101, 102, 103, 104, 105, 106, 107, 108, 109, 120, 121, 130, 131, 132, 140, 141, 142, 143, 150, 151, 152, 153, 154, 160, 161, 162, 163, 164, 165, 170, 171, 172, 173, 174, 175, 176, 180, 181, 182, 183, 184, 185, 186, 187, 190, 191, 192, 193, 194, 195, 196
Offset: 1

Views

Author

Jerome Abela (Jerome.Abela(AT)gmail.com), Nov 22 2008

Keywords

Comments

Complement of union of A009994 and A009996. - Ray Chandler, Oct 25 2011
Number of n-digit bouncy numbers is 9*10^(n-1) - (n+18)*binomial(n+8, 8)/9 + 10. - Altug Alkan, Oct 02 2018

Crossrefs

Cf. A152464. - Jon E. Schoenfield, Dec 06 2008

Programs

  • Mathematica
    Select[Range[0,200], !LessEqual@@IntegerDigits[#] && !GreaterEqual@@IntegerDigits[#]&] (* Ray Chandler, Oct 25 2011 *)
    bnQ[n_]:=Module[{didn=Differences[IntegerDigits[n]]},Count[didn,?(#>0&)]>0 && Count[didn,?(#<0&)]>0]; Select[Range[100,200],bnQ] (* Harvey P. Dale, Jun 13 2020 *)
  • Python
    a = 1
    b = 100
    while a != 51:
        if str(b) != ''.join(sorted(str(b))) and str(b) != ''.join(sorted(str(b)))[::-1]:
            print(b)
            a += 1
        b += 1
    # David F. Marrs, Sep 25 2018
    
  • Python
    from itertools import count, islice
    def A152054_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            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:
                    yield n
                    break
    A152054_list = list(islice(A152054_gen(),30)) # Chai Wah Wu, Jul 28 2023

Extensions

More terms from Jon E. Schoenfield, Dec 06 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-2 of 2 results.