Let ( S = {1, 2, 3, \ldots, 40} ). We want to find the maximum size of a subset ( A \subseteq S ) such that no two elements in ( A ) have their sum divisible by 5.
Let's proceed step by step:
Step 1: Consider residues modulo 5
Each element ( x \in S ) can be written as ( x \equiv r \pmod{5} ), where ( r \in {0, 1, 2, 3, 4} ).
- If ( a, b \in A ) and ( a + b ) is divisible by 5, then ( a \equiv -b \pmod{5} ).
So, for each pair of residues ( (r, 5-r) ), we cannot have both in ( A ).
Step 2: Count elements of each residue class
Let's count how many numbers in ( S ) have each residue modulo 5:
- Numbers congruent to ( r ) modulo 5 are: ( r, r+5, r+10, \ldots ) up to 40.
For ( r = 0 ): ( 5, 10, 15, 20, 25, 30, 35, 40 ) (8 numbers)
For ( r = 1 ): ( 1, 6, 11, 16, 21, 26, 31, 36 ) (8 numbers)
For ( r = 2 ): ( 2, 7, 12, 17, 22, 27, 32, 37 ) (8 numbers)
For ( r = 3 ): ( 3, 8, 13, 18, 23, 28, 33, 38 ) (8 numbers)
For ( r = 4 ): ( 4, 9, 14, 19, 24, 29, 34, 39 ) (8 numbers)
So, each residue class has 8 elements.
Step 3: Choose residues to maximize ( |A| )
We cannot have both ( r ) and ( 5-r ) in ( A ):
- Pairs: ( (1,4) ), ( (2,3) ), and ( 0 ) is self-inverse.
So, for each pair, we can choose at most one residue class.
-
For ( r = 0 ), we can have at most one element (since ( 0 + 0 \equiv 0 \pmod{5} )), so at most one element from the set ( {5, 10, 15, 20, 25, 30, 35, 40} ).
-
For each pair ( (1,4) ) and ( (2,3) ), we can take all 8 elements from either residue, but not both.
Step 4: Maximize the total
So, the maximum is:
[
\max |A| = 1 \text{ (from residue 0)} + 8 \text{ (from either 1 or 4)} + 8 \text{ (from either 2 or 3)} = 1 + 8 + 8 = \boxed{17}
]
Step 5: Example of such a set
- Take 1 element from ( {5, 10, 15, 20, 25, 30, 35, 40} ), say 5.
- Take all 8 elements congruent to 1 mod 5: ( {1, 6, 11, 16, 21, 26, 31, 36} ).
- Take all 8 elements congruent to 2 mod 5: ( {2, 7, 12, 17, 22, 27, 32, 37} ).
Total: ( 1 + 8 + 8 = 17 ).
Final Answer
[
\boxed{17}
]
is the maximum number of elements possible in ( A ).