This question can be solved by Gap method.
In this method first, arrange the remaining candidates. Here the remaining candidates =6.
Hence the remaining candidates can be arranged in 6! ways.
xOxOxOxOxOxOx
x: places available for mathematics candidates
O: places for others
There are seven places available for mathematics candidates so that no two mathematics candidates are together. Now, 4 candidates can be placed in these 7 places in 7C4 ways.
Hence, the total number of ways = 6!. 7C4=720×840=604800
Sum of digit is 18