Let the sum of the digits with a plus sign in front of them be x and the absolute value of the sum of the digits with a minus sign in front of them be y. Then the value v of the expression equals x−y. Also x+y=0+1+2+3+4+5+6+7+8+9=45. Therefore v=45−2y.
a) As 45−2y≤45, nothing greater than 45 can be the value of the expression. We now show that we can obtain all the positive odd integers up to 45 as the result of the expression; this shows that the least positive integer that cannot be equal to the result is 47.
We previously showed that y=245−v. In order to make the value of the expression be v, we need to put a minus sign in front of some digits that sum up to 245−v. As v is a positive odd integer between 1 and 45, the number 245−v is a nonnegative integer between 0 and 22. Each such positive integer can be written as a sum of digits as follows: numbers from 1 to 9 are among the digits themselves, numbers from 10 to 17 can be obtained as the sum of 9 and some other digit, and numbers 18 to 22 can be written as the sum of 9, 8 and some other digit in the range of 1 to 5. The case y=0 corresponds to the version where every digit has a plus sign in front of it.
b) Number 2 cannot be obtained as the value of the expression, because solving 2=45−2y gives y=21.5, which is impossible in integers. The number 2 is also the least positive even number.