Recurrence Relation : Divisible Numbers

146 Views Asked by At

Given an integer, n, find the smallest integer m such that is divisible by n (i.e.n, is a factor of m ) and satisfies the following properties:

  1. m must not contain zeroes in its decimal representation.
  2. The sum of m's digits must be greater than or equal to the product of m's digits. Given n, find the number of digits in m's decimal representation.

Note: n is not divisible by 10.

How should I derive the Recurrence Relation for this problem?

My approach: Suppose the n = 32, I am multiplying n by 1,2,3... and checking for the number at the units place if the number at the unit's place is greater than the largest digit of n and the number at the tens digit is greater than smallest digit of n then I ignore the m generated and move to the next multiplication.

I am not able to come up with the recurrence relation for doing this operation. Please Help! Thanks!