Question 562362
Hi, I'll describe two ways of solving this problem.
First, you could think that the first, fourth, and seventh positions have 6 options, while the rest have 7 options.  This means that there are 6*7*7*6*7*7*6=518616 total permutations.
Second, you could think that there are 7^7 total perm., 7^6 perm. with a 1 in the first place, with a 4 in the fourth place, with a 7 in the seventh place, 7^5 perm. with 1 in first 4 in fourth, with 1 in first 7 in seventh, with 4 in fourth 7 in seventh, and there are 7^4 perm. with 1 in first 4 in fourth 7 in seventh.  So, there should be 7^7-3*7^6+3*7^5-7^4=518616 total permutations.