Bouncy number Created 2026-10-20 Updated 2026-11-05
In decimal representation, a bouncy number is a positive integer whose sequence of numerical digits is neither nondecreasing nor nonincreasing from left to right. Equivalently, one adjacent pair strictly rises and another strictly falls. For example, is bouncy, while and are not. Repeated numerical digits are permitted by the weak order conditions: is nondecreasing.
A number satisfying both weak order conditions has every numerical digit equal, so the overlap consists exactly of the positive repdigits, such as . If count the nondecreasing, nonincreasing and repdigit positive integers at most , respectively, inclusion-exclusion gives the count of bouncy numbers as
This reduces counting the complement of two monotonicity conditions to counting those two simpler families and their explicit overlap.