<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://drorbn.net/index.php?action=history&amp;feed=atom&amp;title=10-1100-cjeagleA1Code</id>
	<title>10-1100-cjeagleA1Code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://drorbn.net/index.php?action=history&amp;feed=atom&amp;title=10-1100-cjeagleA1Code"/>
	<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=10-1100-cjeagleA1Code&amp;action=history"/>
	<updated>2026-09-18T04:53:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://drorbn.net/index.php?title=10-1100-cjeagleA1Code&amp;diff=9596&amp;oldid=prev</id>
		<title>Cjeagle at 16:20, 12 October 2010</title>
		<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=10-1100-cjeagleA1Code&amp;diff=9596&amp;oldid=prev"/>
		<updated>2010-10-12T16:20:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:20, 12 October 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is the C++ source code I used to solve the MegaMinx.  Aside from BigInteger, which is a class in the public domain, it uses only standard C++.  The algorithm is not terribly efficient (took about 6 hours to run), but it got the job done.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is the C++ source code I used to solve the MegaMinx.  Aside from&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  ([http://mattmccutchen.net/bigint/&lt;/ins&gt; BigInteger&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; by Matt McCutcheon])&lt;/ins&gt;, which is a class in the public domain, it uses only standard C++.  The algorithm is not terribly efficient (took about 6 hours to run), but it got the job done.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cjeagle</name></author>
	</entry>
	<entry>
		<id>https://drorbn.net/index.php?title=10-1100-cjeagleA1Code&amp;diff=9591&amp;oldid=prev</id>
		<title>Cjeagle at 16:15, 12 October 2010</title>
		<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=10-1100-cjeagleA1Code&amp;diff=9591&amp;oldid=prev"/>
		<updated>2010-10-12T16:15:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is the C++ source code I used to solve the MegaMinx.  Aside from BigInteger, which is a class in the public domain, it uses only standard C++.  The algorithm is not terribly efficient (took about 6 hours to run), but it got the job done.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;quot;BigIntegerLibrary.hh&amp;quot;             &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
//sloppy code, but it made it easier to write&lt;br /&gt;
const int N = 132;&lt;br /&gt;
const int numGens = 12;&lt;br /&gt;
&lt;br /&gt;
typedef vector&amp;lt;int&amp;gt; perm;&lt;br /&gt;
&lt;br /&gt;
perm table[N][N];&lt;br /&gt;
perm ID;&lt;br /&gt;
perm blank;&lt;br /&gt;
&lt;br /&gt;
/*to make it easier to input generating permutations&lt;br /&gt;
this algorithm takes in a list of an even number of numbers&lt;br /&gt;
and produces the permutation which sends a(i) to a(i+1) for each even i*/&lt;br /&gt;
perm permGen(vector&amp;lt;int&amp;gt; a){&lt;br /&gt;
     perm result(N);&lt;br /&gt;
     &lt;br /&gt;
     for(int i=0;i&amp;lt;N; i++){&lt;br /&gt;
             result[i] = i;&lt;br /&gt;
     }&lt;br /&gt;
     for(int i=0;i&amp;lt;a.size()-1;i+=2){&lt;br /&gt;
             result[a[i]]=a[i+1];&lt;br /&gt;
     }&lt;br /&gt;
     return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//an error-checking routine, making sure every element of the table is&lt;br /&gt;
//a valid permutation&lt;br /&gt;
bool isPerm(perm a){&lt;br /&gt;
     int checkr[N];&lt;br /&gt;
     for(int i=0;i&amp;lt;N;i++){&lt;br /&gt;
             for(int j=0;j&amp;lt;N;j++){&lt;br /&gt;
                     if(a[j] == i){checkr[i] = i;}&lt;br /&gt;
             }&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     for(int i=0; i&amp;lt;N;i++){&lt;br /&gt;
             if(checkr[i] != i){return false;}&lt;br /&gt;
     }&lt;br /&gt;
     return true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//tests if two tables of permutations are the same&lt;br /&gt;
bool tableEqual(perm a[N][N], perm b[N][N]){&lt;br /&gt;
     for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
             for(int j=0; j&amp;lt;N; j++){&lt;br /&gt;
                     if(a[i][j] != b[i][j]){return false;}&lt;br /&gt;
             }&lt;br /&gt;
     }&lt;br /&gt;
     return true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//Write one permutation to standard output&lt;br /&gt;
//Used for testing and error-checking&lt;br /&gt;
void permOutput(perm a){&lt;br /&gt;
     cout &amp;lt;&amp;lt; &amp;quot;[&amp;quot;;&lt;br /&gt;
     for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
             cout &amp;lt;&amp;lt; a[i] &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
     cout &amp;lt;&amp;lt; &amp;quot;]&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//write the entire table to standard output&lt;br /&gt;
//this was useful in testing on small groups, but would not be suitable for&lt;br /&gt;
//groups as large as the MegaMinx&lt;br /&gt;
void tableOutput(){&lt;br /&gt;
     for(int i=0;i&amp;lt;N;i++){&lt;br /&gt;
             for(int j=0;j&amp;lt;N;j++){&lt;br /&gt;
                     permOutput(table[i][j]);&lt;br /&gt;
                     cout &amp;lt;&amp;lt; &amp;quot;   &amp;quot;;&lt;br /&gt;
             }&lt;br /&gt;
             cout &amp;lt;&amp;lt; endl;&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//find the pivot position of a permutation&lt;br /&gt;
int pivotPosition(perm s){&lt;br /&gt;
    for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
            if(s[i] != i) return i;&lt;br /&gt;
    }&lt;br /&gt;
    return -1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//given permutations a and b, produce ab&lt;br /&gt;
perm mult(perm a, perm b){&lt;br /&gt;
     perm result(N);&lt;br /&gt;
     for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
        result[i] = a[b[i]];&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//given a permutation a, produce a^{-1}&lt;br /&gt;
perm invert(perm a){&lt;br /&gt;
     perm result(N);&lt;br /&gt;
     for(int i=0;i&amp;lt;N;i++){&lt;br /&gt;
        for(int j=0;j&amp;lt;N;j++){&lt;br /&gt;
          if(a[j] == i){result[i] = j;}&lt;br /&gt;
        }&lt;br /&gt;
     }&lt;br /&gt;
     return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//the Feed algorithm from class&lt;br /&gt;
void Feed(perm s) {&lt;br /&gt;
     if(s == ID){return;}&lt;br /&gt;
     &lt;br /&gt;
     int pivot = pivotPosition(s);&lt;br /&gt;
     int value = s[pivot];&lt;br /&gt;
     if(table[pivot][value] == blank){&lt;br /&gt;
        table[pivot][value] = s;&lt;br /&gt;
        return;&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     Feed(mult(invert(table[pivot][value]), s));   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//compute the product of the sizes of the columns in the table&lt;br /&gt;
BigInteger groupOrder(){&lt;br /&gt;
     BigInteger result = 1;&lt;br /&gt;
     BigInteger colSize[N];&lt;br /&gt;
     for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
             colSize[i] = 0;&lt;br /&gt;
             for(int j=0;j&amp;lt;N;j++){&lt;br /&gt;
                     if(table[i][j] != blank){colSize[i] = colSize[i]+1;}&lt;br /&gt;
             }&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
             result = result * colSize[i];&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     return result;&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    ofstream outputFile;&lt;br /&gt;
    outputFile.open(&amp;quot;megaminx.txt&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    outputFile &amp;lt;&amp;lt; &amp;quot;MegaMinx&amp;quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; endl;&lt;br /&gt;
    //start by initializing the two constant permutations - blank and identity.&lt;br /&gt;
    //we make blank and invalid permutation for easier error-checking&lt;br /&gt;
    for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
            ID.push_back(i);&lt;br /&gt;
            blank.push_back(-1);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    perm generators[numGens];&lt;br /&gt;
&lt;br /&gt;
/*Generators come from rotating the marked face counterclockwise*/&lt;br /&gt;
  int gens[numGens][50] = {&lt;br /&gt;
      {3,1,10,3,0,10,7,0,1,7,6,2,9,6,8,9,4,8,2,4,17,55,14,56,11,57,55,46,56,49,57,53,46,101,49,104,53,108,101,110,104,111,108,112,110,17,111,14,112,11},                                         /*orange*/&lt;br /&gt;
      {20,13,21,20,17,21,11,17,13,11,19,16,18,19,14,18,12,14,16,12,112,72,115,69,119,66,72,28,69,25,66,22,28,61,25,58,22,55,61,3,58,6,55,10,3,112,6,115,10,119},                                 /*grey*/&lt;br /&gt;
      {31,24,32,31,28,32,22,28,24,22,27,23,30,27,29,30,25,29,23,25,66,77,67,78,68,79,77,39,78,36,79,33,39,65,36,62,33,61,65,13,62,16,61,20,13,66,16,67,20,68},                                   /*red*/&lt;br /&gt;
      {35,33,42,35,43,42,39,43,33,39,38,34,41,38,40,41,36,40,34,36,79,88,82,89,86,90,88,50,89,47,90,44,50,64,47,63,44,65,64,24,63,27,65,31,24,79,27,82,31,86},                                   /*light blue*/&lt;br /&gt;
      {46,44,53,46,54,53,50,54,44,50,49,45,52,49,51,52,47,51,45,47,90,99,93,100,97,101,99,7,100,4,101,1,7,57,4,60,1,64,57,35,60,38,64,42,35,90,38,93,42,97},                                     /*light brown*/&lt;br /&gt;
      {57,55,64,57,65,64,61,65,55,61,60,56,63,60,62,63,58,62,56,58,22,33,23,34,24,35,33,44,34,45,35,46,44,1,45,2,46,3,1,11,2,12,3,13,11,22,12,23,13,24},                                         /*purple*/&lt;br /&gt;
      {68,66,75,68,76,75,72,76,66,72,71,67,74,71,73,74,69,73,67,69,119,127,118,124,120,121,127,83,124,80,121,77,83,32,80,29,77,28,32,20,29,19,28,21,20,119,19,118,21,120},                       /*light green*/&lt;br /&gt;
      {86,79,87,86,83,87,77,83,79,77,82,78,85,82,84,85,80,84,78,80,121,94,122,91,123,88,94,43,91,40,88,39,43,31,40,30,39,32,31,68,30,71,32,75,68,121,71,122,75,123},                             /*dark brown*/&lt;br /&gt;
      {97,90,98,97,94,98,88,94,90,88,93,89,96,93,95,96,91,95,89,91,123,105,126,102,130,99,105,54,102,51,99,50,54,42,51,41,50,43,42,86,41,85,43,87,86,123,85,126,87,130},                         /*pink*/&lt;br /&gt;
      {108,101,109,108,105,109,99,105,101,99,104,100,107,104,106,107,102,106,100,102,130,116,129,113,131,110,116,0,113,8,110,7,0,53,8,52,7,54,53,97,52,96,54,98,97,130,96,129,98,131},           /*dark green*/&lt;br /&gt;
      {119,112,120,119,116,120,110,116,112,110,115,111,118,115,117,118,113,117,111,113,131,76,128,73,127,72,76,21,73,18,72,17,21,10,18,9,17,0,10,108,9,107,0,109,108,131,107,128,109,127},       /*dark blue*/&lt;br /&gt;
      {123,121,130,123,131,130,127,131,121,127,122,124,126,122,129,126,128,129,124,128,120,109,117,106,116,105,109,98,106,95,105,94,98,87,95,84,94,83,87,75,84,74,83,76,75,120,74,117,76,116}    /*magenta*/&lt;br /&gt;
  };&lt;br /&gt;
  &lt;br /&gt;
  //construct the actual generators from the above list&lt;br /&gt;
  for(int i=0;i&amp;lt;numGens; i++){&lt;br /&gt;
          generators[i] = permGen(vector&amp;lt;int&amp;gt;(gens[i], gens[i]+50));&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  //prepare a blank table&lt;br /&gt;
    for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
            for(int j=0; j&amp;lt;N; j++){&lt;br /&gt;
                    table[i][j] = blank;&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
            &lt;br /&gt;
    //set the diagonal of the table to be the identity permutation&lt;br /&gt;
    for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
             table[i][i] = ID;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //write out the complete list of generators&lt;br /&gt;
    outputFile &amp;lt;&amp;lt; &amp;quot;The generating permutations are: &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
    for(int i=0;i&amp;lt;numGens;i++){&lt;br /&gt;
            outputFile &amp;lt;&amp;lt; &amp;quot;[&amp;quot;;&lt;br /&gt;
            for(int j=0; j&amp;lt;N; j++){&lt;br /&gt;
                    outputFile &amp;lt;&amp;lt; generators[i][j] &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
            outputFile &amp;lt;&amp;lt; &amp;quot;]&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Feed the generators into the table&lt;br /&gt;
    for(int i=0; i&amp;lt;numGens; i++){&lt;br /&gt;
            Feed(generators[i]);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    perm tableCopy[N][N];&lt;br /&gt;
    &lt;br /&gt;
    do{&lt;br /&gt;
       //put a copy of table in tableCopy, so we can check if anything changed&lt;br /&gt;
        for(int i=0; i&amp;lt;N; i++){&lt;br /&gt;
            for(int j=0;j&amp;lt;N;j++){&lt;br /&gt;
                    tableCopy[i][j] = perm(table[i][j]);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        //check each pair of indices.  Every time we find (i,j) and (k,l) such that&lt;br /&gt;
        //table[i][j] and table[k][l] have entries, we feed the product of those entries&lt;br /&gt;
        for(int i=0;i&amp;lt;N;i++){&lt;br /&gt;
                for(int j=0; j&amp;lt;N; j++){&lt;br /&gt;
                        if(table[i][j] != blank){&lt;br /&gt;
                                       for(int k=0;k&amp;lt;N;k++){&lt;br /&gt;
                                               for(int l=0;l&amp;lt;N;l++){&lt;br /&gt;
                                                       if(table[k][l] != blank){&lt;br /&gt;
                                                                      Feed(mult(table[i][j], table[k][l]));&lt;br /&gt;
                                                       }&lt;br /&gt;
                                               }&lt;br /&gt;
                                       }&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        //keep on going until nothing changes&lt;br /&gt;
    }while(!tableEqual(tableCopy, table));    &lt;br /&gt;
    &lt;br /&gt;
    //now the size of G is the product of the sizes of the columns.&lt;br /&gt;
    BigInteger orderOfGroup = groupOrder();&lt;br /&gt;
    outputFile &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; &amp;quot;The order of the subgroup of S_132 generated by the above is: &amp;quot; &amp;lt;&amp;lt; orderOfGroup;&lt;br /&gt;
    outputFile.close();&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cjeagle</name></author>
	</entry>
</feed>