Let ω be a root of x2+x+1=0. Then ω3=1 and ω=1.
Since x2+x+1 divides x2n+xn+1, we have ω2n+ωn+1=0.
Let y=ωn. Then y2+y+1=0, so y=ω or y=ω2.
Thus, ωn=ω or ωn=ω2.
This means n≡1(mod3) or n≡2(mod3).
So n is any positive integer not exceeding 2014 such that n≡0(mod3).
The possible values of n are those with 1≤n≤2014 and n≡0(mod3).
Let us compute the sum of all such n.
First, the sum of all n from 1 to 2014 is:
S=1+2+⋯+2014=22014×2015=2,029,105
Now, subtract the sum of all n divisible by 3 in this range.
The smallest such n is 3, the largest is 2013.
The sequence is 3,6,9,…,2013.
Number of terms:
Let k be the number of terms. 3k=2013⟹k=671.
Sum of these terms:
S3=3+6+9+⋯+2013=3(1+2+⋯+671)=3×2671×672=3×225,456=676,368
Therefore, the sum of all n not divisible by 3 is:
2,029,105−676,368=1,352,737
Answer: 1,352,737