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.

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