Let the fourth number be 'a'
Suppose LCM of 3, 5, 12 and a = x
And LCM of 3, 5, 21, and a = y
Using prime factorization,
12 = 2 × 2 × 3
21 = 3 × 7
Given : x = y
So, a should contain the factors 2 × 2 ×7
Thus, a = 2 × 2 × 7 = 28
Again using prime factorization,
3 = 3
5 = 5
12 = 2 × 2 × 3
21 = 3 × 7
28 = 2 × 2 × 7
So, L. C. M. of 3, 5, 12, and 28 = 3 × 5 × 2 × 2 × 7 = 420
L. C. M. of 3, 5, 21 and 28 = 3 × 5 × 2 × 2 × 7 = 420
So, the fourth number is 28
The prime factors of 3, 5, 12 are 3, 4, 5
and the prime factors for 3, 5, 21 are 3, 5, 7
In order for the LCM to be the same the prime factors have to be the same. but in the first case 7 is missing and in the second case 4 is missing. So, the answer should be a product of these two numbers ie 28.
Now, with 28, the prime factors for 3, 5, 12, 28 are 3, 4, 5, 7 and the LCM will be 3 * 4* 5 * 7 = 420
and as with 21 the prime factors for 3, 5, 21, 28 are 3, 4, 5, 7 and the LCM again is 3 *4 * 5* 7 = 420
Hence 28 is the answer.
Note: There are many answers to the question and 28 is the smallest possible number and all the multiples of 28 are possible solutions for this question.