Lets take n=1
Now 31=3 identical digits i.e
111 which is not divisible by 2,5,7
And divisible by 3.
All other 3 digit numbers like 222,333,444 are multiple of 111 and hence of 3.
Now, for $n=2$, we get $3^2 = 9$. 111111111 is a multiple of 9. and similarly any $3^n$ digit number composed of only 1, is divisible by $3^n$, and composed of any other number is also divisible by $3^n.$
so Option B is Correct Ans.