Calculate a six digit number that is smaller than 500000 such that the sum of its digits is 43 exactly.

499849

Let us begin with the maximum sum of a digit under 500000. Of course it will be the sum of 499999.
4 + 9 + 9 + 9 + 9 + 9 = 49.

Now, the required number must be close to it.
Rooting 499999, we get 707.106
Taking the square of 707, we get 499849.
4 + 9 + 9 + 8 + 4 + 9 = 43

Thus, the required number is 499849.