Solution:
a.
They exist: it suffices to take, for example, a=102024−1 and b=102024+8.
To prove this, observe that the base-10 representation of a consists of 2024 consecutive digits equal to 9, so that s(a)=9⋅2024, while b is written as a digit 1 followed by 2023 digits 0 and a digit 8, so that s(b)=9. At this point
2023⋅(b−a)=2023⋅9=2024⋅9−9=s(a)−s(b),
which is equivalent to the claim.
b.
They exist: it suffices to take, for example, a=793 and b=19000 (among the solutions with a<b this is also the one with the smallest possible b). Indeed
b−a=18207=2023⋅9=2023⋅(19−10)=2023⋅(s(a)−s(b)),
which is equivalent to the claim.
Heuristic for part (a)
One possible strategy for finding an example is the following. Observe that, if we write b=a+k, then
2023⋅b+s(b)=2023⋅a+2023⋅k+s(a+k),
and the original equation becomes
s(a)=2023⋅k+s(a+k),
which clearly shows that s(a+k) must be much smaller than s(a).
It is then natural to choose as a a number made up entirely of digits 9 and k small (for instance, a single digit), so that b=a+k is a number starting with the digit 1, followed by many zero digits, and hence s(b) is much smaller than s(a).
At this point it only remains to correctly choose k and the number of digits 9 in a: if a consists of c digits equal to 9, then s(a)=9c. Taking k to be a single-digit number, b=a+k is written as a digit 1, followed by many zeros and finally by the digit k−1, so that s(b)=s(a+k)=k. Substituting these choices into the initial equation we obtain
2023a+s(a)=2023a+9cand2023b+s(b)=2023a+2023k+k
that is, we get the equation 9c=2024k. Since we are looking for k made up of a single digit, it is natural to take k=9 and c=2024, which gives the solution described above.
Heuristic for part (b)
One possible strategy for finding an example is the following. Writing the equation in the form
b−a=2023⋅(s(a)−s(b))
we observe that the difference b−a is a multiple of 2023. On the other hand, it is well known that the sum of the digits of a leaves the same remainder as a upon division by 9: writing then s(a)=a−9x,s(b)=b−9y we obtain b−a=2023(a−9x−b+9y), that is
2024(b−a)=9⋅2023⋅(y−x).
Since 9 and 2024 have no common prime factors, this equation shows that b−a is also divisible by 9. Moreover, 2023 also has no factors in common with 9, so b−a (being a multiple of 2023 and of 9) is a multiple of 9⋅2023=18207.
At this point we write b=a+18207k and substitute into the initial equation: we find that
a+2023⋅s(a)=a+18207k+2023⋅s(a+18207k)
from which
s(a)=9k+s(a+18207k).
Trying to choose k=1, we would like to find two numbers a and b=a+18207 such that the sum of the digits of b is 9 less than the sum of the digits of a. At this point it is not hard to conclude: in order for s(a+18207) to be smaller than s(a) we would like there to be some carrying, and one of the simplest choices to try is precisely a=793, so that a+18207=19000 has many digits 0. One immediately checks that this choice works.
General solutions
It is possible to find general solutions to the equations of the problem, in which 2023 is replaced by any positive integer N. The first equation in general form, N⋅a+s(a)=N⋅b+s(b), admits as a solution a=10N+1−1,b=a+9: indeed N⋅(b−a)=9N=9(N+1)−9=s(a)−s(b).
To study the second equation in general form, a+N⋅s(a)=b+N⋅s(b), observe that the identity s(x+y)=s(x)+s(y)−9r(x,y) holds, where r(x,y) is the number of carries obtained in adding x,y in columns. We then define B=1+9s(9N) and call C the number of digits of 9N minus one; we then set a=10C(10B−1) and b=a+9N.
The number a then consists of B digits 9 followed by C digits 0 (in particular, s(a)=9B=9+s(9N)). Adding a and 9N in columns, by construction B carries occur (each digit 9 causes one and only one carry), so r(a,9N)=B and s(b)=s(a+9N)=s(a)+s(9N)−9r(a,9N)=9B+s(9N)−9B=s(9N). Substituting into the initial equation we then have
b−a=9N=N(9+s(9N)−s(9N))=N(s(a)−s(b)).