Divisibility by 7 of a number consisting of 0 and 1's A decimal number is of arbitrary length consisting of 0 and 1 only  i.e. (10,111,10000,11111,1010, number of digits in the number can be upto 100 )
Can this number ever be divisible by 7  if yes, is there any efficient way to list all those numbers 

Note that $10 \equiv 3 \bmod 7$ and the powers of $3$ modulo $7$ are:
$$3^0=1,\ 3^1=3,\ 3^2=2,\ 3^3=6,\ 3^4=4,\ 3^5=5$$
It follows that $10^k \equiv 3^r \bmod 7$ where $r$ is the remainder of $k$ modulo $6$, so you can find the remainder of a number consisting of only $0$s and $1$s modulo $7$ by splitting its decimal expansion into groups of $6$, replacing each '$1$' by whichever digit it corresponds to in the above, and adding them all together.
For example consider the number $110010 101010 010011$. We can break it up as
$$110010~101010~010011$$
Using the above, this is congruent to
$$(3^5+3^4+3^1)+(3^5+3^3+3^1)+(3^4+3^1+3^0)$$
which is itself congruent to 
$$(5+4+3)+(5+6+3)+(4+2+1)$$
modulo $7$. This gives $110010101010010011 \equiv 33 \equiv 6 \bmod 7$.
This gives an algorithm for determining whether such a number $n$ is divisible by $7$ (and its efficiency is $O(\log n)$, which is pretty good). This also hints at a way of listing all such numbers.
