Find the smallest number comprised of only 3’s and 7’s which fits the following conditions:

1) It has at least one 3;

2) It has at least one 7;

3) It is divisible by 3;

4) It is divisible by 7;

5) The sum of its digits is divisible by 3;

6) The sum of its digits is divisible by 7.

(In reply to

answer by K Sengupta)

Let N be the smallest number which contains precisely p number of 3's and q number of 7's.

Then, s.o.d(N) = 3p+7q. Since (3p+7q) is divisible by 3, it follows that the minimum q must be 3, and alos since (3p+7q) is divisible by 7, it follows that the least p must be 7. Thus N must contain at least three 7's and at least seven 3's. Since the location of 7's does not affect the divisiblity of N by 7, we will determine the remainders of 3*10^q, for q = 0, 1, 2, ..., 9 when divided by 7.

We observe that for q= 1,2,3,4,5,6,7,8,9; the respective residues of 3*(10^n) are 3,2,6,4,5,1,3,2,6,4. Therefore, the remainder when the number 3,333,333,333 is divided by 7 will correspond to 3+2+6+4+5+1+3+2+6+4 = 36 (mod 7) = 1 (mod 7). Thus, 3,333,333,333 leaves a remainder of 1

We will now consider triplets of q such that the sum of the residues is 1 (mod 7) and replacing the 3's in these positions by 7's we will arrive at the desired N.

checking for the possible triplets (0,1,6); (0,2,8); (0,3,5); (1,3,7); (1,4,5);(2,3,4) etc, we observe that for the triplet (2,3,4), the residues are (6,4,5), and since (6+4+5)(mod 7) = 1, we replace the 3's in the third, fourth and the fifth position from the right by 7's in the number 3,333,333,333 to obtain 3,333,377,733.

Consequently, the required smallest number is 3,333,377,733.

*Edited on ***July 8, 2008, 3:56 pm**