3,384 karma · joined June 23, 2014
It has various features to control and adjust these diagrams to be visually pleasing, by changing sizing/spacing/curviness/arrow style/etc of the elements within these diagrams. This is all much more convenient in its WYSIWYG interface than manually planning and coding these figures in LaTeX, as had previously been the standard way to create them for mathematical papers.
In general, a directed (multi)graph along with an account of which of its paths are and are not to be considered equivalent to each other (where this equivalence relation satisfies some basic nice properties) is known as a "category". This concept comes up ubiquitously in math/abstract logic/etc. Commutative diagrams are useful for quickly visually reasoning about equivalences of paths in such contexts.
Note that the arithmetic-harmonic mean I think you were going for is just the geometric mean (not the arithmetic-geometric mean, just the geometric mean simpliciter; see https://mathworld.wolfram.com/Arithmetic-HarmonicMean.html).
In other words, for each possible termination point (including making it all the way through), consider how many non-terminating questions come before that termination point, raise 2 to that power, and then sum these all up.
Thus, len(question_paths(totq, term)) is equal to sum([2**(term[i] - i) for i in range(len(term))]) + 2**(totq - len(term)).
(Much more generally, Hall's marriage theorem characterizes which finite bipartite graphs have a perfect matching, and there are polynomial-time algorithms to compute maximum cardinality matchings in arbitrary finite graphs.)
Presumably, what you have in mind here is the proof of Fermat's little theorem by saying "The integers modulo prime p under multiplication form a monoid of size p, among which the invertible subgroup comprises precisely the values not equivalent to zero (thus, of size p - 1). Within these, the order e of any value x is equivalent to the size of the subgroup x generates, which by Lagrange's theorem (decomposing the entire group into its cosets; i.e., its isomorphic orbits under the subgroup acting freely upon it) must divide the size of the overall group. Thus, x^(p - 1) = 1 mod p".
Yes, you can say all that in group-theoretic language. But someone skeptical of the value of group theory might object "All you are doing is using fancy words to say what could be said more straightforwardly. After all, Fermat's little theorem was understood by Fermat and others two hundred years before group theory was invented. Euler published his generalization of Fermat's little theorem a hundred years before group theory was invented. All your fancy-schmancy group theory is just pointlessly obfuscatory language for describing something already well understood".
And indeed, all group theory is doing in this case is showing us how to relate this one particular result to many other similar results. But that is the value of abstraction and generalization. That is how math often works. Recognizing a common pattern that comes up repeatedly, making particular instances obvious in retrospect, through fluently understanding their shared connection, once and for all. That's how it worked for groups, and that's the same way it works for categories.