Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Let's scratch (2) because its too hard. But for (1) I was hoping for either an exact expression OR some approximate expression that works well for strings with $L \geq 10$ and $q \geq 2$ or so. I'm less interested in asymptotics, but that's not to say I didn't appreciate the paper.
From the paper (researchgate.net/publication/…) I don't think there's going to be a reasonable analytic expression for the exact probability for (1). Scenario (2) seems hopeless. Do you agree with this?
@BrendanMcKay Sorry for the typo, it should now be fixed. Also, thanks in general for your comment - this ended up being tricky for me to work out and I feel relieved to know at least one other person doesn't think the problem is trivial.