Ta có: \(A=a_1+a_2+a_2+...+a_{2017}=2019^{2018}=3^{2018}.673^{2018}\)
\(\Rightarrow A⋮3\). (1)
Lai có \(B-A=(a_1^3+a_2^3+...+a_{2017}^3)-\left(a_1+a_2+...+a_{2017}\right)\)
\(=\left(a_1^3-a_1\right)+\left(a_2^3-a_2\right)+...+\left(a_{2017}^3-a_{2017}\right)\)
Mat khac \(a_i^3-a_i=\left(a_i-1\right).a_i.\left(a_i+1\right)⋮3\) \(\left(1\le i\le2017\right)\)
Vậy từ đó ta suy ra \(B-A⋮3\) (2)
\(\left(1\right);\left(2\right)\Rightarrow B⋮3\)