17
A loop is a pretty simple algebraic structure. It is a tuple (G,+) where G is a set and + is a binary operator G × G → G. That is + takes two elements from G and returns a new element. The operator is also required to fulfill two properties
Cancellation: For every a and b in G there exists unique x and y in G such that
a + x = b y + a = b
Identity: There is an e in G such that for every a in G
e + a = a a + e = a
If you are familiar with the concept of a group you might notice that a loop is just a group that doesn't have an associative property.
Loops are pretty simple so people like to add more rules to make new structures that are more interesting. One such structure is a Moufang loop which is a loop that also satisfies the following four identities forall x, y and z in G
z + (x + (z + y)) = ((z + x) + z) + y
((y + z) + x) + z = y + (z + (x + z))
(z + x) + (y + z) = (z + (x + y)) + z
(z + x) + (y + z) = z + ((x + y) + z)
For example the following Cayley table represents a Moufang loop:
0 1 2 3
1 0 3 2
2 3 0 1
3 2 1 0
(If you are not familiar a Cayley table is a square matrix M where Mi,j is equal to i + j. It is a handy way for representing binary operators on a set.)
We can show that there is an identity rather easily it is 0
. Cancellation is a little harder to show but a brute force approach yields this table
b a → 0 1 2 3
↓
0 0 1 2 3
1 1 0 3 2
2 2 3 0 1
3 3 2 1 0
Where our elements are the solutions to
a + x = b = x + a
(You may notice that this table is identical to our Cayley table. I'll leave it as an exercise to the reader to figure out why this is the case for this Moufang loop)
Now we need to verify the Moufang identities for our structure. There are two ways to do this for the particular structure the first way is to realize that it is associative and thus automatically fulfills the criteria, however this will not work in general so we would rather brute force the result. There are 3 free variables each with a potential of 4 values in every expression here. This means we have to perform 7*43 or 448 computations. I'll leave out the raw computations but here is some Haskell you can use to verify this.
Task
Given a positive integer n as input output the number of Moufang loops that have order n. (the order of a group is the size of the set)
This is code-golf so answers will be scored in bytes with fewer bytes being better.
Test cases
Here is the number of Moufang loops for the first 71 inputs
1,1,1,2,1,2,1,5,2,2,1,6,1,2,1,19,1,5,1,6,2,2,1,20,2,2,5,5,1,4,1,122,1,2,1,18,1,2,2,19,1,7,1,5,2,2,1,103,2,5,1,6,1,17,2,17,2,2,1,18,1,2,4,4529,1,4,1,6,1,4,1
1What is "G × G"? – Erik the Outgolfer – 2018-01-02T21:01:25.827
@EriktheOutgolfer The direct product of G and G its the set of all pairs of elements of G, this basically says that + takes two things from G and returns a thing in G – Post Rock Garf Hunter – 2018-01-02T21:02:38.883
8I downvoted this challenge, because the mathematics involved is quite fluffy and not accessible to everyone who reads this challenge. Perhaps, a worked example would be helpful (like, explaining why the the 8th input results in 5)? If you add one I think I will retract my vote, but of course that is up to you. – None – 2018-01-02T21:09:33.947
6@IanGödel Could you clarify what you mean by fluffy? It is certainly a more advanced mathematical topic but I don't think that we should shy away from math on PPCG. I'll add a worked example of a Moufang loop, but calculating an entire input by hand would probably clutter the challenge. – Post Rock Garf Hunter – 2018-01-02T21:15:19.630
2@WheatWizard "Fluffy" as in, perhaps, "Advanced". EDIT: I retracted the downvote, but still awaiting an example. – None – 2018-01-02T21:16:21.387
Every group is clearly a moufang loop, but it would be nice to have a non-group example of a moufang loop. I'd guess that there's one of order
6
that's the smallest one? – Giuseppe – 2018-01-02T21:22:29.017@WheatWizard facepalm
D_3
, of course. they better take away my math degree...or at least my A in Algebra :'( – Giuseppe – 2018-01-02T21:28:48.8401@Giuseppe Don't feel too bad, I also made a mistake when correcting yours it's
12
not11
. I should have realized that because11
is prime number. – Post Rock Garf Hunter – 2018-01-02T21:30:41.8831
this is A000001 + A090750
– Giuseppe – 2018-01-02T21:31:02.870@IanGödel Ok I've added an example of showing that a particular input is a Moufang loop. Feel free to voice any more concerns including ways to make this less "fluffy". – Post Rock Garf Hunter – 2018-01-02T21:52:34.027