Define S(∅)=0. Let T0={3,6}, T1={1,4,7}, T2={2,5,8}. For A⊆T, let A0=A∩T0, A1=A∩T1, A2=A∩T2, then
S(A)=S(A0)+S(A1)+S(A2)≡∣A1∣−∣A2∣(mod3),
So 3∣S(A) if and only if ∣A1∣≡∣A2∣(mod3). It follows that
(∣A1∣,∣A2∣)=(0,0),(0,3),(3,0),(3,3),(1,1),(2,2).
The number of nonempty subsets A so that 3∣S(A) is
22(03)(03)+(03)(33)+(33)(03)+(33)(33)+(13)(13)+(23)(23)−1=87.
If 3∣S(A) and 5∣S(A), then 15∣S(A). Since S(T)=36, so the value S(A) is 15 or 30 (if 3∣S(A) and 5∣S(A)).
Furthermore,
15=8+7=8+6+1=8+5+2=8+4+3=8+4+2+1=7+6+2=7+5+3=7+5+2+1=7+4+3+1=6+5+4=6+5+3+1=6+4+3+2=5+4+3+2+1,
36−30=6=5+1=4+2=3+2+1.
So the number of A such that 3∣S(A), 5∣S(A), and A=∅ is 17.
The answer is 87−17=70.