# Given a SmallGroup id of a group of order 2^n, print 
# SmallGroupToHallSenior[n][x] to obtain the Hall-Senior number of the group. 

# Given a Hall-Senior number y of a group of order 2^n, print 
# HallSeniorToSmallGroup[n][y] to obtain the SmallGroup id of the group.

SmallGroupToHallSenior := [ 
     [ 1 ], 
     [ 2, 1 ], 
     [ 3, 2, 4, 5, 1 ], 
     [ 5, 3, 9, 10, 4, 11, 12, 13, 14, 2, 6, 7, 8, 1 ], 
     [ 7, 18, 5, 19, 20, 46, 47, 48, 27, 28, 31, 21, 30, 29, 32, 6, 22, 49,
          50, 51, 3, 11, 12, 16, 14, 15, 33, 36, 37, 38, 39, 40, 41, 34, 35, 
          4, 13, 17, 23, 24, 25, 26, 44, 45, 2, 8, 9, 10, 42, 43, 1 ], 
     [ 11, 8, 38, 131, 132, 62, 63, 237, 238, 239, 240, 234, 235, 236, 65, 
          64, 37, 180, 181, 60, 59, 61, 128, 129, 130, 9, 39, 182, 40, 133, 66,           250, 251, 252, 253, 254, 255, 138, 139, 142, 248, 247, 249, 41, 67, 
          246, 140, 141, 143, 10, 42, 265, 266, 267, 5, 22, 30, 28, 29, 81, 83,
          89, 90, 93, 82, 86, 84, 92, 91, 88, 85, 87, 144, 147, 146, 145, 150,
          151, 149, 148, 152, 153, 6, 23, 31, 32, 24, 94, 96, 123, 126, 124, 
          125, 127, 47, 48, 53, 114, 113, 115, 51, 120, 25, 95, 97, 50, 49, 54,
          116, 52, 121, 33, 98, 102, 34, 99, 100, 55, 56, 57, 118, 119, 117, 
          58, 122, 35, 101, 201, 203, 217, 202, 204, 218, 261, 263, 262, 264, 
          259, 260, 205, 206, 208, 211, 219, 220, 196, 195, 197, 229, 228, 230,
          257, 256, 258, 207, 210, 209, 212, 221, 222, 213, 214, 223, 215, 216,
          224, 193, 194, 200, 232, 231, 233, 189, 188, 192, 198, 225, 226, 191,
          199, 190, 227, 7, 26, 36, 134, 135, 136, 137, 244, 245, 3, 15, 16, 
          20, 18, 19, 27, 106, 108, 107, 68, 71, 72, 73, 77, 74, 75, 76, 80, 
          69, 70, 78, 79, 169, 170, 172, 171, 175, 177, 176, 179, 178, 173, 
          174, 154, 157, 160, 159, 155, 158, 163, 167, 164, 161, 166, 168, 162,
          156, 165, 184, 183, 185, 186, 187, 4, 17, 21, 109, 43, 44, 45, 46, 
          110, 111, 112, 241, 242, 243, 2, 12, 13, 14, 103, 104, 105, 1 ] ];

HallSeniorToSmallGroup := [ 
     [ 1 ], 
     [ 2, 1 ], 
     [ 5, 2, 1, 3, 4 ], 
     [ 14, 10, 2, 5, 1, 11, 12, 13, 3, 4, 6, 7, 8, 9 ], 
     [ 51, 45, 21, 36, 3, 16, 1, 46, 47, 48, 22, 23, 37, 25, 26, 24, 38, 2,
          4, 5, 12, 17, 39, 40, 41, 42, 9, 10, 14, 13, 11, 15, 27, 34, 35, 28,
          29, 30, 31, 32, 33, 49, 50, 43, 44, 6, 7, 8, 18, 19, 20 ], 
     [ 267, 260, 192, 246, 55, 83, 183, 2, 26, 50, 1, 261, 262, 263, 193, 
          194, 247, 196, 197, 195, 248, 56, 84, 87, 103, 184, 198, 58, 59, 57,
          85, 86, 112, 115, 126, 185, 17, 3, 27, 29, 44, 51, 250, 251, 252, 
          253, 95, 96, 107, 106, 101, 110, 97, 108, 118, 119, 120, 124, 21, 20,
          22, 6, 7, 16, 15, 31, 45, 202, 211, 212, 203, 204, 205, 207, 208, 
          209, 206, 213, 214, 210, 60, 65, 61, 67, 71, 66, 72, 70, 62, 63, 69,
          68, 64, 88, 104, 89, 105, 113, 116, 117, 127, 114, 264, 265, 266, 
          199, 201, 200, 249, 254, 255, 256, 99, 98, 100, 109, 123, 121, 122, 
          102, 111, 125, 90, 92, 93, 91, 94, 23, 24, 25, 4, 5, 30, 186, 187, 
          188, 189, 38, 39, 47, 48, 40, 49, 73, 76, 75, 74, 80, 79, 77, 78, 81,
          82, 226, 230, 239, 227, 231, 229, 228, 235, 238, 232, 234, 240, 236, 
          233, 237, 215, 216, 218, 217, 224, 225, 219, 221, 220, 223, 222, 18, 
          19, 28, 242, 241, 243, 244, 245, 174, 173, 181, 179, 175, 167, 168, 
          147, 146, 148, 176, 180, 169, 128, 131, 129, 132, 140, 141, 155, 142,
          157, 156, 143, 158, 161, 162, 164, 165, 130, 133, 144, 145, 159, 160,
          163, 166, 177, 178, 182, 150, 149, 151, 171, 170, 172, 12, 13, 14, 8,
          9, 10, 11, 257, 258, 259, 190, 191, 46, 42, 41, 43, 32, 33, 34, 35, 
          36, 37, 153, 152, 154, 138, 139, 134, 136, 135, 137, 52, 53, 54 ] ];
