I was going through my Highschool, Grade 9, Math Textbook today in my free time since I rarely get freely time in College. I found this question that I failed to answer and our teacher that time didn't discuss it.

The question was:

You are given two positive integers $d$ and $s$. Find the minimal positive integer $n$ which is divisible by $d$ and has the sum of digits equal to $s$.

Let's take $d=13$ and $s=50$, the answer should be $699998$. The answer was given the back of my book.

Is there a formula for doing this?


locked by Michael Greinecker Oct 20 '18 at 18:16

This question is locked in view of our policy about contest questions. Questions originating from active contests are locked for the duration of the contest, with answers hidden from view by soft-deletion. Please see the comments below for references to the originating contest.

Read more about locked posts here.