Solution 1 (bash)
When computing N, the number 2x will be added x times (for terms 2x−20, 2x−21, ..., 2x−2x−1), and subtracted 10−x times. Hence N can be computed as N=10⋅210+8⋅29+6⋅28+⋯−8⋅21−10⋅20. Evaluating Nmod1000 yields:
N=10(210−1)+8(29−21)+6(28−22)+4(27−23)+2(26−24)=10(1023)+8(510)+6(252)+4(120)+2(48)=10(1000+23)+8(500+10)+6(250+2)+480+96≡(0+230)+(0+80)+(500+12)+480+96≡398
Solution 2
This solution can be generalized to apply when 10 is replaced by other positive integers.
Extending from Solution 1, we get that the sum N of all possible differences of pairs of elements in S when S={20,21,22,…,2n} is equal to ∑x=0n(2x−n)2x. Let A=∑x=0nx2x, B=∑x=0n2x. Then N=2A−nB.
For n=10, B=211−1=2047≡47(mod1000) by the geometric sequence formula.
2A=∑x=1n+1(x−1)2x, so 2A−A=A=n2n+1−∑x=1n2x. Hence, for n=10, A=10⋅211−211+2=9⋅211+2≡48⋅9+2=
434(mod1000), by the geometric sequence formula and the fact that 210=1024≡24(mod1000).
Thus, for n=10, N=2A−10B≡2⋅434−10⋅47=868−470=398.
Solution 3
Consider the unique differences 2a+n−2a. Simple casework yields a sum of ∑n=110(2n−1)(211−n−1)=∑n=110211+1−2n−211−n=10⋅211+10−2(2+22+⋯+210) =10⋅211+10−22(210−1)≡480+10−4⋅23≡398(mod1000). This method generalizes nicely as well.
Solution 4 (Extreme bash)
Find the positive differences in all 55 pairs and you will get 398. (This is not recommended unless you can't find any other solutions to this problem)
List of Differences:
1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2, 6, 14, 30, 62, 126, 254, 510, 1022, 4, 12, 28, 60, 124, 252, 508, 1020, 8, 24, 56, 120, 248, 504, 1016, 16, 48, 112, 240, 496, 1008, 32, 96, 224, 480, 992, 64, 192, 448, 960, 128, 384, 896, 256, 768, 512
Solution 5 (Quite Less Bash)
Every value 2a−2b is guaranteed to be different if for all pairs of numbers (a,b) is unordered. In other terms, every pair only appears once, with (a,b) being the same as (b,a).
Imagine cyclically pairing every single element of this list together. Then, we appear with 10 copies of 210, and then from the remaining 9 differences consisting of 29, when summed, coincide with one difference from 210, giving 10−2=8 copies of 29.
If the above wording is weird to you, think of it like this. One of the pairs consisting of 210−2b for some b is 210−29. Then, in all the pairs consisting of 29−2z for some z, we see z=10 as that absolute value yields the same sum. Therefore, we have the number of copies of 210, subtracted with the case including 29, and that result is 10−1=9 copies of 29. However, when we add the cases together, one pair from 210 coincides with one pair from 29, specifically, any 29 case and the case 210−29, in which one more pair cancels out, giving us 8 copies in the sum.
One can then, either through Engineer's Induction or through webbing (the process of mapping every case to one another and showing a result must be true), can realize that every preceding case decreases by 2. Then, we obtain
k=0∑10(10−2k)(210−k)
10(210)+8(29)+6(28)+4(27)+2(26)+0−2(24)−4(23)−6(22)−8(21)−10(mod1000)
240+96+536+512+128−32−32−24−16−10(mod1000)
240+96+48+128−32−32−24−16−10(mod1000)
512−114(mod1000)
398(mod1000)
~Pinotation