To be fair, English is not my native language. But when I see a question “what’s the best way of doing X”, when it doesn’t have any criteria for what’s the best would be, and no other ways of doing X in the question, I consider “what’s the best way” part a redundant figure of speech. I view such questions an equivalent of “what’s a good enough way of doing X”.
> it's asking about a code solution, not just maths/combinatronics
Please read this: https://stackoverflow.com/help/on-topic According to that article, questions about math which don’t imply a code solution are offtopic on stackoverflow.com. They should be closed, and possibly moved to other stachexchange sites. According to that article, the OP’s question is good. The question was about a specific programming problem, and is a practical, answerable problem unique to software development.
Again, they are asking how to solve a math problem, in code. That's a two big-step problem, no attempt to solve it on their own. Big problems:
- Does not show any attempt or willingness to try to solve the problem first on their own.
- Does not even give any indication of where the problem comes from, why it might be interesting, etc., it's just a "how to calculate X?", which could easily be a homework problem.
- It is about finding a (possibly) mathematical solution, and then implement it in C++. Two very big and different problem, asking the audience to do them both. Again no attempt to fix either of these two problems on their own.
- I'll concede the optimal thing might be a language issue.
> I’m not sure that’s actually possible to do.
But that's not my point, my point is that I already showed more willingness to try to solve this problem than OP. And THAT is a big problem. It's not on topic about any of those points, in fact if you remove the bit where OP is asking us to give them the full solution in C++ it could be a good question for the Mathematics SE!
> attempt or willingness to try to solve the problem first on their own… indication of where the problem comes from, why it might be interesting
None of that is required to ask questions on stackoverflow. For details, read “How do I ask a good question?” and “What types of questions should I avoid asking?” help articles. You’re inventing arbitrary restrictions.
Another thing is, “why it might be interesting” is subjective. Personally, I found the question interesting, that’s why I have answered it. You probably think otherwise, but note it only takes 3-5 votes to kill the question. Any question at all is guaranteed to have at least 3-5 people on that site who find it uninteresting, opinion-based, need more focus, duplicate, etc.
> Two very big and different problem, asking the audience to do them both.
Two big problems don’t have solutions which can be both explained in 3 short sentences. As you can see from my answer, the problem formulated in that question has such solution.
> I already showed more willingness to try to solve this problem than OP
You have not. However, you have demonstrated willingness to delete interesting questions based on arbitrary and subjective criteria, despite the question is perfectly in line with the stackoverflow guidelines. Which BTW is very on-topic, because I think that’s the main reason for the fall of SO being discussed here.
To be fair, English is not my native language. But when I see a question “what’s the best way of doing X”, when it doesn’t have any criteria for what’s the best would be, and no other ways of doing X in the question, I consider “what’s the best way” part a redundant figure of speech. I view such questions an equivalent of “what’s a good enough way of doing X”.
> it's asking about a code solution, not just maths/combinatronics
Please read this: https://stackoverflow.com/help/on-topic According to that article, questions about math which don’t imply a code solution are offtopic on stackoverflow.com. They should be closed, and possibly moved to other stachexchange sites. According to that article, the OP’s question is good. The question was about a specific programming problem, and is a practical, answerable problem unique to software development.
> can already try to think about brute-forcing it
I’m not sure that’s actually possible to do.