The forty days

Answer it in your head first.

Your bleeding stops cleanly at twenty three days. What are you required to do about prayer, and what do you owe for the twenty three days you did not pray?

You perform ghusl and you resume praying at twenty three days. You do not wait for day forty, because forty is the outer limit rather than a period to be served. And you owe nothing for the twenty three days. There is no prayer debt from nifas. If the bleeding then restarts, that is one of the edge cases and it goes to your scholar rather than to a guess.