Calculate the number of non-bouncy numbers with at most n digits. >>> non_bouncy_exact(1) 9 >>> non_bouncy_exact(6) 7998 >>> non_bouncy_exact(10) 136126
(n: int)
| 35 | |
| 36 | |
| 37 | def non_bouncy_exact(n: int) -> int: |
| 38 | """ |
| 39 | Calculate the number of non-bouncy numbers with at most n digits. |
| 40 | >>> non_bouncy_exact(1) |
| 41 | 9 |
| 42 | >>> non_bouncy_exact(6) |
| 43 | 7998 |
| 44 | >>> non_bouncy_exact(10) |
| 45 | 136126 |
| 46 | """ |
| 47 | return choose(8 + n, n) + choose(9 + n, n) - 10 |
| 48 | |
| 49 | |
| 50 | def non_bouncy_upto(n: int) -> int: |
no test coverage detected