Letting $$N={p_1}^{q_1}\cdot {p_2}^{q_2}\cdots \cdot {p_k}^{q_k}\ \ (p_i\ \text{are primes}, q_i\ge 1\in\mathbb N,k\in\mathbb N)$$ be your number, the following has to be satisfied (see here for details): $$(q_1+1)(q_2+1)\cdots(q_k+1)=40=2^3\cdot 5.$$ (Here, LHS represents _the number of the positive divisors of $N$_.)
So, separate it into cases as the followings :
(1) Since $40=40$, $N=p^{39}$. Hence, we have $2^{39}.$ (Note this is the smallest number in _this case_ )
(2) Since $40=2\times 20$, $N={p_1}^{1}\cdot {p_2}^{19}$. Hence, we have $3^1\cdot 2^{19}.$
(3) Since $40=4\times 10$, $N={p_1}^{3}\cdot {p_2}^{9}$. Hence we have $3^3\cdot 2^9$.
Can you take it from here? Note that there are still several cases.