[Tutor] help with this problem
Steven D'Aprano
steve at pearwood.info
Sun Apr 24 14:12:24 CEST 2011
Ratna Banjara wrote:
> The number 124 has the property that it is the smallest number whose
> first three multiples contain the digit 2. Observe that
> 124*1 = 124, 124*2 = 248, 124*3 = 372 and that 124, 248 and 372 each
> contain the digit 2. It is possible to generalize this property to be
> the smallest number whose first n multiples each contain the digit 2.
> Write a function named smallest(n) that returns the smallest number
> whose first n multiples contain the digit 2. Hint: use modulo base 10
> arithmetic to examine digits.
>
> Its signature is
> int smallest(int n)
>
> You may assume that such a number is computable on a 32 bit machine,
> i.e, you do not have to detect integer overflow in your answer.
Do you have a Python question, or would you just like us to do your
homework for you?
This is a mailing list for learning Python. Please make an attempt to
solve the problem, and if you still have trouble, show us what your code
is, what error you get, and we'll try to help you with Python.
--
Steven
More information about the Tutor
mailing list