An integer is divisible by 6, 7, and 8 if and only if it is divisible by their Least Common Multiple, which equals 6×7×4=168.
Let n be a positive integer and let A be an arbitrary set of n consecutive positive integers. Replace each number ai from A with its remainder ri (mod 168). The number ai is divisible by 6 (7 or 8) if and only if its remainder ri is divisible by 6 (respectively 7 or 8). The difference ∣ai−aj∣ is divisible by 168 if and only if their remainders ri=rj.
Choosing k numbers from the initial set A, which verify the required conditions, is the same as choosing k their remainders (mod 168) such that:
1. each chosen remainder is not divisible by 6, 7, and 8;
2. all chosen remainders are different.
Suppose we have chosen k numbers from A, which verify the conditions. Therefore, all remainders are different and k≤168 (otherwise, there would be two equal remainders).
Denote by B={0,1,2,3,…,167} the set of all possible remainders (mod 168) and by Bm the subset of all elements of B, which are divisible by m. Compute the number of elements of the following subsets:
∣B6∣=168÷6=28,∣B7∣=168÷7=24,∣B8∣=168÷8=21∣B6∩B7∣=∣B42∣=168÷42=4,∣B6∩B8∣=∣B24∣=168÷24=7∣B7∩B8∣=∣B56∣=168÷56=3,∣B6∩B7∩B8∣=∣B168∣=1
Denote by D=B6∪B7∪B8, the subset of all elements of B, which are divisible by at least one of the numbers 6, 7, or 8. By the Inclusion-Exclusion principle we got
∣D∣=∣B6∣+∣B7∣+∣B8∣−(∣B6∩B7∣+∣B6∩B8∣+∣B7∩B8∣)+∣B6∩B7∩B8∣=28+24+21−(4+7+3)+1=60.
Each chosen remainder belongs to the subset B∖D, since it is not divisible by 6, 7, and 8. Hence, k≤∣B∖D∣=168−60=108.
Let us show that the greatest possible value is k=108. Consider n=168. Given any collection A of 168 consecutive positive integers, replace each number with its remainder (mod 168). Choose from these remainders 108 numbers, which constitute the set B∖D. Finally, take 108 numbers from the initial set A, having exactly these remainders. These k=108 numbers verify the required conditions.