1. Define the problem and notation:
We need to determine the sum
S⊂{1,2,…,3n}3∣f(S)∑f(S)
where f(S) is the sum of the elements of S and S runs through all subsets of {1,2,…,3n} such that f(S) is a multiple of 3.
2. Sum of all elements:
The sum of all elements in {1,2,…,3n} is:
k=1∑3nk=23n(3n+1)
This sum is divisible by 3 because 3n(3n+1)/2 is an integer and 3n is a multiple of 3.
3. Complementary subsets:
For any subset S⊂{1,2,…,3n}, let Sc be its complement. Then:
f(S)+f(Sc)=23n(3n+1)
Since 23n(3n+1) is divisible by 3, f(S) is a multiple of 3 if and only if f(Sc) is a multiple of 3.
4. **Sum of f(S) and f(Sc):**
U=S⊂{1,2,…,3n}3∣f(S)∑f(S)
By symmetry, we have:
U=S⊂{1,2,…,3n}3∣f(S)∑f(Sc)
Therefore:
2U=S⊂{1,2,…,3n}3∣f(S)∑(f(S)+f(Sc))=23n(3n+1)S⊂{1,2,…,3n}3∣f(S)∑1
5. **Number of subsets S such that 3∣f(S):**
Let an denote the number of subsets S⊂{1,2,…,3n} such that 3∣f(S). Then:
2U=23n(3n+1)an
U=43n(3n+1)an
6. **Recursive relation for an:**
Consider any subset S′⊂{1,2,…,3n−3}. We can adjoin one set from one of the following pairs to it:
- {3n} or {3n−1,3n−2} if 3∣f(S′)
- {3n−1} or {3n,3n−1} if 3∣f(S′)+1
- {3n−2} or {3n,3n−2} if 3∣f(S′)+2
This gives us 2×23n−3=23n−2 sets S⊂{1,2,…,3n} with 3∣f(S).
7. Counting subsets:
Any set not generated by this method must contain all of {3n,3n−1,3n−2} or none of it, and in either case, it is counted in an−1. Hence:
an=2an−1+23n−2
8. Solving the recurrence:
Substitute bn=2nan:
bn=bn−1+4n−1
With a1=4, we have b1=2. Solving the recurrence:
bn=2+4+42+⋯+4n−1=34n−1+2=34n+2
Therefore:
an=2nbn=2n(34n+2)=32n+1(22n−1+1)
9. **Final expression for U:**
U=43n(3n+1)an=43n(3n+1)⋅32n+1(22n−1+1)=2n−1(22n−1+1)n(3n+1)