- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Program to count n digit integers where digits are strictly increasing in Python

Suppose we have a number n, we have to find the number of n-digit positive integers such that the digits are in strictly increasing order.

So, if the input is like n = 3, then the output will be 84, as numbers are 123, 124, 125, ..., 678,789

To solve this, we will follow these steps −

if n < 9 is non-zero, then

return Combination (9Cn)

otherwise,

return 0

Let us see the following implementation to get better understanding −

## Example

from math import factorial as f class Solution: def solve(self, n): if n < 9: return f(9) / f(n) / f(9 - n) else: return 0 ob = Solution() print(ob.solve(3))

## Input

3

## Output

84

- Related Questions & Answers
- Print all n-digit strictly increasing numbers in C++
- Count Strictly Increasing Subarrays in C++
- Program to check whether list is strictly increasing or strictly decreasing in Python
- Program to find nearest number of n where all digits are odd in python
- Count of m digit integers that are divisible by an integer n in C++
- Program to find number of strictly increasing colorful candle sequences are there in Python
- Program to find length of contiguous strictly increasing sublist in Python
- A strictly increasing linked list in Python
- Program to find number not greater than n where all digits are non-decreasing in python
- Strictly increasing sequence JavaScript
- Check if list is strictly increasing in Python
- Program to count number of stepping numbers of n digits in python
- Program to find length of longest strictly increasing then decreasing sublist in Python
- Make Array Strictly Increasing in C++
- Count positive integers with 0 as a digit and maximum ‘d' digits in C++

Advertisements