# Program to find multiple of n with only two digits in Python

PythonServer Side ProgrammingProgramming

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
Updated on 11-Oct-2021 07:15:16