S
Steven D'Aprano
After all, everybody knows that for m items taken n at a time, the
counts are
perm w/repl = m**n
comb w/repl = (m+n-1)!/(n!(m-1)!)
perm wo/repl = m!/(m-n)!
comb wo/repl = m!/(n!(m-n)!)
"Everybody" knows? Be careful with those sweeping generalizations.
Combinatorics is a fairly specialized area not just of programming but
mathematics as well.
I've done a spot poll of four developers here (two juniors and two
seniors) and *not one* could give all four formulae correctly first go.
One guy didn't recognize the terms (although on being reminded, he got
two of the four formula). Another one, a self-professed maths-geek,
worked them out from first principles.