Let the number of marbles be M,
then,
M=6a+4 (when shared among 6 students)
M=7b+4 (when shared among 7 students)
M=8a+4 (when shared among 8 students)
thus
M-4=6a
M-4=7b
M-4=8c
That is M-4 is the smallest number which is a multiple of 6, 7 and 8
Thus we need to find the LCM(6, 7, 8)
LCM(6, 7, 8)=LCM(2*3, 7, 2*2*2) = 2*2*2*3*7=8*21=168
The smallest M-4 is 168,
so the smallest M is 168+4=172
Answer: 172