#Playing with numbers

A positive integer is said to have satisfied a property X X if that integer is a multiple of the sum of its digits. At least how many consecutive integers, starting from 1, should be taken so that 2021 of them satisfy this property?

This is the first problem of a series. For more : #Playing with numbers-2 , #Playing with numbers-3 , #Playing with numbers-4 , #Playing with numbers-5


The answer is 12690.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Aryan Sanghi
May 11, 2021

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def sumd(x):
    s = 0
    while x > 0:
        s += x%10
        x = x//10
    return s

count, x = 0, 1

while count < 2021:
    count += (x%sumd(x) == 0)
    x += 1

print(x - 1)


Output

1
12690

I tried to do it with Mathematics 😀

Aashay Agarwal - 2 days, 7 hours ago

Log in to reply

Cool! It would be amazing if you'll share your solution with us!

Aryan Sanghi - 2 days, 7 hours ago
Rafsan Rcc
May 8, 2021

Here is the C code that I used

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...