The pattern involves assigning numerical values based on the positions of the letters in the alphabet. The word CAT translates as:
C = 3, A = 1, T = 20. So, 3 * 1000 + 1 * 100 + 20 = 3120.
Similarly, for DOG:
D = 4, O = 15, G = 7. So, 4 * 1000 + 15 * 100 + 7 = 4157.