In my opinion, the question How to proven a programming function in math is better suited for math.stackexchange, because, at the end of the question, the user is asking for a mathematical proof.
When a question is migrated, do answers get migrated along with it? (I do not know). If so, what happens to all the answers containing code snippets (or even pseudocode), because they certainly don't fit math.stackexchange.
To put it in another way: what is the migration policy when the question is not suited for the current site, but its answers are?
EDIT:
The term 'better suited' can be read as 'off-topic', this is my acceptation of the term.
I have received feedback describing what should be generally done about off-topic questions. What I am asking is what to do about the combination of off-topic question plus received on-topic answers. Should we disregard the answers, and simply treat the question like any other off-topic question?
There are 3 possible resolutions to this, none of them looking quite right:
Keep the question; downside - the question is off-topic
Delete the question; downside - we loose the on-topic answers, which contain valuable content
Migrate the question to another site; downside - although the question will become on-topic, its answers will now be off-topic
2nd edit
As it was pointed out in the comments below, can an off-topic question actually receive on-topic answers? That is a nice philosophical question. But from a technical point of view, a stack overflow question can ask for two different things. I would describe this situation as an aggregate question being composed of atomic questions. If one atomic question is off-topic and the other is on topic, in my opinion this makes the aggregate question off-topic. However, good answers can be received for the on-topic atomic question. I think this is exactly the situation in the link posted above, when the user is asking for two things : an algorithm to maximize a formula (on-topic), and proof of correctness (off-topic)