Un=(1+2+3+⋯+(n−1))⋅n=2(n−1)n2.
Then Sn=Sn−1+Un for n≥3. Note that Un is divisible by 3 if n≡0 or 1(mod3); and if n≡2(mod3), then (n−1)n2≡1(mod3) and is even, so Un≡2(mod3). Hence Sn+3≡Sn+2(mod3) for n≥2. It is readily verified that S2≡S3≡S4≡2(mod3), so S5≡S6≡S7≡1(mod3) and S8≡S9≡S10≡0(mod3), and it follows that Sn is divisible by 3 if and only if n≡0 or ±1(mod9). Thus the sum of the 10 least values of n that satisfy the required condition is
8+9+10+17+18+19+26+27+28+35=197.
The sum of the products jk as j and k run independently from 1 to n is
(1+2+⋯+n)2=(2n(n+1))2.
To eliminate the cases in which j=k, subtract
12+22+⋯+n2=6n(n+1)(2n+1).
Thus
1≤j≤n1≤k≤nj=k∑jk=4n2(n+1)2−6n(n+1)(2n+1)=12(n−1)n(n+1)(3n+2).
For a given pair j,k with j=k either j<k or j>k, but their product is the same in either order. To impose the condition j<k, it suffices to divide by 2. Thus
Sn=24(n−1)n(n+1)(3n+2).
There is one factor of 3 in the denominator. For any n, exactly one of n+1,n,n−1 is divisible by 3, and 3n+2 is not divisible by 3. In order that Sn be divisible by 3 it is necessary and sufficient that the factor that is divisible by 3 should in fact be divisible by 9. That is, n≡0 or ±1(mod9), and the answer can be calculated as above.