OFFSET
1,1
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.
LINKS
Project Euler, Problem 113. Non-bouncy numbers.
Index entries for linear recurrences with constant coefficients, signature (11,-55,165,-330,462,-462,330,-165,55,-11,1).
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
EXAMPLE
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.
MATHEMATICA
a[n_] := -1 - 10 n + Binomial[9 + n, n] + 1/10 (1 + n) Binomial[10 + n, 1 + n]; Table[a[n], {n, 100}]
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Peter Cullen Burbery, Jul 19 2023
STATUS
approved