Problem

Source: MDA TST 2016

Tags: combinatorics



Let $n\in \mathbb{Z}_{> 0}$. The set $S$ contains all positive integers written in decimal form that simultaneously satisfy the following conditions: each element of $S$ has exactly $n$ digits; each element of $S$ is divisible by $3$; each element of $S$ has all its digits from the set $\{3,5,7,9\}$ Find $\mid S\mid$