Case 1: z=7 a1+a2+a3+a4+a5+a6+a7=0✓a1a2a4+a2a3a5+a3a4a6+a4a5a7+a5a6a1+a6a7a2+a7a1a3=0✓⇒1 case
Case 2: z=6
WLOG a1=0. a1+a2+a3+a4+a5+a6+a7=a1=1 or 2, which is not a multiple of 3. ×
Case 3: z=5
WLOG ai,aj=0, where 1≤i<j≤7. a1+a2+a3+a4+a5+a6+a7=ai+aja1a2a4+a2a3a5+a3a4a6+a4a5a7+a5a6a1+a6a7a2+a7a1a3=0✓3∣ai+aj⇒{ai,aj}={1,2}17×26=42
Case 4: z=4
WLOG ai,aj,ak=0, where 1≤i<j<k≤7. A=a1+a2+a3+a4+a5+a6+a7=ai+aj+akB=a1a2a4+a2a3a5+a3a4a6+a4a5a7+a5a6a1+a6a7a2+a7a1a3 To make A a multiple of 3: {ai,aj,ak}={1,1,1},{2,2,2} To make B a multiple of 3: {ai,aj,ak}={a1,a2,a4},{a2,a3,a5},…,{a7,a1,a3}⇒2((37)−7)=56
Case 5: z=3⇒0,0,0,1,1,2,2 A=a1+a2+a3+a4+a5+a6+a7B=a1a2a4+a2a3a5+a3a4a6+a4a5a7+a5a6a1+a6a7a2+a7a1a3 At most one term out of the 7 terms of B can be nonzero. 3∣B⇒B=0⇒We should select 4 ai’s to be nonzeroTotal=(47) Bad: Select 3 ai's of one term of B to be nonzero
and select one more aj to be nonzero ⇒7×4. 1,1,2,22!2!4!Select 4 good ai’s((47)−7×4)=6(35−28)=42
Case 6: z=2 2≡−1(mod3)0,0,1,1,1,1,−10,0,−1,−1,−1,−1,1 These 2 cases are similar. We consider the first one and at the end of this case multiply the answer by 2.
Use casework based on the distance of two 0's =d.
Case 6-1: d=13∣B=a1a2a4+a2a3a5=a2(a1a4+a3a5)⇒3∣a1a4+a3a5 One of them should be −1. ⇒3∣1(−1)+1×1=0✓⇒0,07×a2=11×−14=28
Case 6-2: d=23∣B=a1a2a4+a3a4a6=a4(a1a2+a3a6) Similarly, a4=1,−1∈{a1,a2,a3,a6}⇒0,07×a4=11×−14=28
Case 6-3: d=3Similar to Hints 9 and 10 ⇒28 cases.
Case 7: z=1 0,1,1,1,1,1,10,1,1,1,−1,−1,−10,−1,−1,−1,−1,−1,−1 The first case and the third case are similar.
So we need to just count the first and the second one.
Case 7-1: 0,1,1,1,1,1,1
WLOG3∤B=4×⇒0 cases
Case 7-2: 0,1,1,1,−1,−1,−1
WLOG a7=0, a1=1; then at the end of this case we multiply the answer by a7=07×a1=±12=14 Base your casework on the places of the other two 1's.
Case 7-2) 0,1,1,1,−1,−1,−1, a7=0, a1=1⇒6
Case 8: z=0 1,1,1,1,1,−1,−11,1,−1,−1,−1,−1,−1 Both cases are similar ⇒
We only consider the first case.
Use casework and base your casework on the places of two −1's and WLOG assume a7=−1.
⇒0 cases
By Hints 2 to 16: Ans=z=71+z=60+z=542+z=456+z=342+z=22(28+28+28)+z=1(0+2×7×6)+z=00=1+42+56+42+168+84=393