What is the smallest number of times that the digit 1 can appear in N?

96 Views Asked by At

All the digits of the positive number $N$ are either $0$ or $1$. The remainder after dividing $N$ by $37$ is $18$. What is the smallest number of times that the digit $1$ can appear in $N$?

I have that $N\equiv 18\pmod {37}$ and I'm not sure but I think $N\equiv 1\pmod {10}$ also.

1

There are 1 best solutions below

0
On BEST ANSWER

Since $$1000\equiv 1 \pmod{37},$$ we have: for $n\ge3$, $$10^n\equiv 10^{n\bmod 3} \pmod{37}.$$ This helps you to "shift" $1$s to the first three digits(I don't know how to describe this... but for example, $11001100\equiv 10+1+0+0+1+100+0+0\equiv 112\pmod{37}$.).

Now it seems easy to treat the problem: you only have to consider numbers$<999$, and find one whose sum of digits is minimum.