5. Find the minimum positive integer such that it is divisible by A and the sum of its digits is equal to B - Link
# Note: solution exists not for all A anb B!!! Example: A=3, B=8
def find1(a, b):
i = 1
while True:
if sum(map(int, list(str(i * a)))) == b:
break
i += 1
return a * i
Comments
Leave a comment