There's a thing in math called "combinations" where order doesn't matter (247 is the same as 742) and a thing called "permutations" where order does matter (247 is different than 742). For safe combinations, even though everyone calls them combinations, the math word would be permutations because if 247 opens the safe, 742 does not.
Also, with a safe, you can use numbers over again. A 6 digit combination using 2, 4, and 7 could just be 222222.
Each number in the safe's combination doesn't affect the next number, so the number of combinations with 2, 4, and 7 is just 3^6 = 729
Answer: 729 possible combinations
.
If it's just 2 and 4, then 2^6 = 64
Answer: 64 possible combinations.