- 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 find multiple of n with only two digits in Python

Suppose we have a number n. We have to find the least positive value x such that x is made up of only two digits 9's and 0's, and x is multiple of n.

So, if the input is like n = 26, then the output will be 90090.

To solve this, we will follow these steps −

- m := 9
- x := 1
- while m is not divisible by n, do
- x := x + 1
- m := replace all 1s with 9s in the binary form of x

- return m as integer

## Example

Let us see the following implementation to get better understanding −

def solve(n): m = 9 x = 1 while m % n != 0: x += 1 m = int(bin(x)[2:].replace('1','9')) return m n = 26 print(solve(n))

## Input

26

## Output

90090

- Related Questions & Answers
- Program to find last two digits of 2^n in C++
- Program to Find Out Integers Less than n Containing Multiple Similar Digits in C++
- Find last two digits of sum of N factorials using C++.
- Program to find minimum digits sum of deleted digits in Python
- Program to find nearest number of n where all digits are odd in python
- Program to count number of stepping numbers of n digits in python
- Program to find number of substrings with only 1s using Python
- Find n-th element in a series with only 2 digits (and 7) allowed in C++
- Program to find last two digits of Nth Fibonacci number in C++
- Find Numbers with Even Number of Digits in Python
- Print numbers with digits 0 and 1 only such that their sum is N in C Program.
- Program to find sum of digits in base K using Python
- Python Program to Reverse only First N Elements of a Linked List
- Python program to find Intersection of two lists?
- Find largest number smaller than N with same set of digits in C++

Advertisements