M-Sequence

A sequence is called M-sequence if after removing zero or more elements from the sequence the GCD of its remaining elements is M. The M-value is the summation of the removed elements. The significant point is if there are multiple ways of element removing to make the sequence M-sequence, we have to remove such way so that M-value is minimum possible. Let’s consider the following sequence:


This is a companion discussion topic for the original entry at https://toph.co/p/m-sequence