login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A204692 a(n) is the number of base-10 bouncy numbers below 10^n. 2
0, 0, 525, 8325, 95046, 987048, 9969183, 99932013, 999859093, 9999722967, 99999479435, 999999059545, 9999998358645, 99999997221695, 999999995423887, 9999999992645451, 99999999988439336, 999999999982190246, 9999999999973063281, 99999999999959940181, 999999999999941340896 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

COMMENTS

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

LINKS

Muniru A Asiru, Table of n, a(n) for n = 1..200

Project Euler, Non-bouncy numbers Problem 113

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]

EXAMPLE

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.

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 *)

PROG

(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

(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

(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

CROSSREFS

Cf. A152054.

Sequence in context: A152464 A284961 A217742 * A168308 A294984 A020379

Adjacent sequences:  A204689 A204690 A204691 * A204693 A204694 A204695

KEYWORD

nonn,base,easy

AUTHOR

Thomas Quirk, Jan 18 2012

EXTENSIONS

Corrected and extended by Altug Alkan, Sep 27 2018

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 5 18:22 EDT 2021. Contains 346488 sequences. (Running on oeis4.)