Code to Find Distinguished Triad

For a given 7-imaginary quaternionic grouping and given signmask, the following code (in C) finds the distinguished triad (if any). The user is prompted for quaternionic grouping number 0-29 and signmask (as per table below, as explained in main article):
0: 1 2 3    0 9 14 20 23 27 28     08 0f 11 16 22 25 3b 3c 43 44 5a 5d 69 6e 70 77 
1: 1 2 4    0 9 14 21 22 26 29     0b 0c 12 15 21 26 38 3f 40 47 59 5e 6a 6d 73 74 
2: 1 2 5    0 10 13 19 24 27 28    03 04 1a 1d 29 2e 30 37 48 4f 51 56 62 65 7b 7c 
3: 1 2 6    0 10 13 21 22 25 30    02 05 1b 1c 28 2f 31 36 49 4e 50 57 63 64 7a 7d 
4: 1 2 7    0 11 12 19 24 26 29    0a 0d 13 14 20 27 39 3e 41 46 58 5f 6b 6c 72 75 
5: 1 3 4    0 11 12 20 23 25 30    09 0e 10 17 23 24 3a 3d 42 45 5b 5c 68 6f 71 76 
6: 1 3 5    1 6 14 17 23 27 31     02 05 1b 1c 28 2f 31 36 49 4e 50 57 63 64 7a 7d 
7: 1 3 6    1 6 14 18 22 26 32     01 06 18 1f 2b 2c 32 35 4a 4d 53 54 60 67 79 7e 
8: 1 3 7    1 7 13 16 24 27 31     09 0e 10 17 23 24 3a 3d 42 45 5b 5c 68 6f 71 76 
9: 1 4 5    1 7 13 18 22 25 33     08 0f 11 16 22 25 3b 3c 43 44 5a 5d 69 6e 70 77 
10: 1 4 6   1 8 12 16 24 26 32     00 07 19 1e 2a 2d 33 34 4b 4c 52 55 61 66 78 7f 
11: 1 4 7   1 8 12 17 23 25 33     03 04 1a 1d 29 2e 30 37 48 4f 51 56 62 65 7b 7c 
12: 1 5 6   2 5 14 17 21 29 31     09 0e 10 17 23 24 3a 3d 42 45 5b 5c 68 6f 71 76 
13: 1 5 7   2 5 14 18 20 28 32     0a 0d 13 14 20 27 39 3e 41 46 58 5f 6b 6c 72 75 
14: 1 6 7   2 7 11 15 24 29 31     02 05 1b 1c 28 2f 31 36 49 4e 50 57 63 64 7a 7d 
15: 2 3 4   2 7 11 18 20 25 34     02 05 1b 1c 28 2f 31 36 49 4e 50 57 63 64 7a 7d 
16: 2 3 5   2 8 10 15 24 28 32     0b 0c 12 15 21 26 38 3f 40 47 59 5e 6a 6d 73 74 
17: 2 3 6   2 8 10 17 21 25 34     09 0e 10 17 23 24 3a 3d 42 45 5b 5c 68 6f 71 76 
18: 2 3 7   3 5 13 16 21 30 31     02 05 1b 1c 28 2f 31 36 49 4e 50 57 63 64 7a 7d 
19: 2 4 5   3 5 13 18 19 28 33     00 07 19 1e 2a 2d 33 34 4b 4c 52 55 61 66 78 7f 
20: 2 4 6   3 6 11 15 23 30 31     09 0e 10 17 23 24 3a 3d 42 45 5b 5c 68 6f 71 76 
21: 2 4 7   3 6 11 18 19 26 34     09 0e 10 17 23 24 3a 3d 42 45 5b 5c 68 6f 71 76 
22: 2 5 6   3 8 9 15 23 28 33      01 06 18 1f 2b 2c 32 35 4a 4d 53 54 60 67 79 7e 
23: 2 5 7   3 8 9 16 21 26 34      02 05 1b 1c 28 2f 31 36 49 4e 50 57 63 64 7a 7d 
24: 2 6 7   4 5 12 16 20 30 32     08 0f 11 16 22 25 3b 3c 43 44 5a 5d 69 6e 70 77 
25: 3 4 5   4 5 12 17 19 29 33     0b 0c 12 15 21 26 38 3f 40 47 59 5e 6a 6d 73 74 
26: 3 4 6   4 6 10 15 22 30 32     03 04 1a 1d 29 2e 30 37 48 4f 51 56 62 65 7b 7c 
27: 3 4 7   4 6 10 17 19 27 34     02 05 1b 1c 28 2f 31 36 49 4e 50 57 63 64 7a 7d 
28: 3 5 6   4 7 9 15 22 29 33      0a 0d 13 14 20 27 39 3e 41 46 58 5f 6b 6c 72 75 
29: 3 5 7   4 7 9 16 20 27 34      09 0e 10 17 23 24 3a 3d 42 45 5b 5c 68 6f 71 76 
30: 3 6 7      
31: 4 5 6      
32: 4 5 7      
33: 4 6 7      
34: 5 6 7      

C Code

The algorithm code follows a table, one line per quaternionic grouping, each line listing the signmasks making its corresponding grouping the true octonions. User is prompted for 0-based line number, and signmask; program returns distinguished triad (if any).
#include <stdio.h>

int untwisteds[30][16] = {
{0x08,0x0f,0x11,0x16,0x22,0x25,0x3b,0x3c,0x43,0x44,0x5a,0x5d,0x69,0x6e,0x70,0x77},
{0x0b,0x0c,0x12,0x15,0x21,0x26,0x38,0x3f,0x40,0x47,0x59,0x5e,0x6a,0x6d,0x73,0x74},
{0x03,0x04,0x1a,0x1d,0x29,0x2e,0x30,0x37,0x48,0x4f,0x51,0x56,0x62,0x65,0x7b,0x7c},
{0x02,0x05,0x1b,0x1c,0x28,0x2f,0x31,0x36,0x49,0x4e,0x50,0x57,0x63,0x64,0x7a,0x7d},
{0x0a,0x0d,0x13,0x14,0x20,0x27,0x39,0x3e,0x41,0x46,0x58,0x5f,0x6b,0x6c,0x72,0x75},
{0x09,0x0e,0x10,0x17,0x23,0x24,0x3a,0x3d,0x42,0x45,0x5b,0x5c,0x68,0x6f,0x71,0x76},
{0x02,0x05,0x1b,0x1c,0x28,0x2f,0x31,0x36,0x49,0x4e,0x50,0x57,0x63,0x64,0x7a,0x7d},
{0x01,0x06,0x18,0x1f,0x2b,0x2c,0x32,0x35,0x4a,0x4d,0x53,0x54,0x60,0x67,0x79,0x7e},
{0x09,0x0e,0x10,0x17,0x23,0x24,0x3a,0x3d,0x42,0x45,0x5b,0x5c,0x68,0x6f,0x71,0x76},
{0x08,0x0f,0x11,0x16,0x22,0x25,0x3b,0x3c,0x43,0x44,0x5a,0x5d,0x69,0x6e,0x70,0x77},
{0x00,0x07,0x19,0x1e,0x2a,0x2d,0x33,0x34,0x4b,0x4c,0x52,0x55,0x61,0x66,0x78,0x7f},
{0x03,0x04,0x1a,0x1d,0x29,0x2e,0x30,0x37,0x48,0x4f,0x51,0x56,0x62,0x65,0x7b,0x7c},
{0x09,0x0e,0x10,0x17,0x23,0x24,0x3a,0x3d,0x42,0x45,0x5b,0x5c,0x68,0x6f,0x71,0x76},
{0x0a,0x0d,0x13,0x14,0x20,0x27,0x39,0x3e,0x41,0x46,0x58,0x5f,0x6b,0x6c,0x72,0x75},
{0x02,0x05,0x1b,0x1c,0x28,0x2f,0x31,0x36,0x49,0x4e,0x50,0x57,0x63,0x64,0x7a,0x7d},
{0x02,0x05,0x1b,0x1c,0x28,0x2f,0x31,0x36,0x49,0x4e,0x50,0x57,0x63,0x64,0x7a,0x7d},
{0x0b,0x0c,0x12,0x15,0x21,0x26,0x38,0x3f,0x40,0x47,0x59,0x5e,0x6a,0x6d,0x73,0x74},
{0x09,0x0e,0x10,0x17,0x23,0x24,0x3a,0x3d,0x42,0x45,0x5b,0x5c,0x68,0x6f,0x71,0x76},
{0x02,0x05,0x1b,0x1c,0x28,0x2f,0x31,0x36,0x49,0x4e,0x50,0x57,0x63,0x64,0x7a,0x7d},
{0x00,0x07,0x19,0x1e,0x2a,0x2d,0x33,0x34,0x4b,0x4c,0x52,0x55,0x61,0x66,0x78,0x7f},
{0x09,0x0e,0x10,0x17,0x23,0x24,0x3a,0x3d,0x42,0x45,0x5b,0x5c,0x68,0x6f,0x71,0x76},
{0x09,0x0e,0x10,0x17,0x23,0x24,0x3a,0x3d,0x42,0x45,0x5b,0x5c,0x68,0x6f,0x71,0x76},
{0x01,0x06,0x18,0x1f,0x2b,0x2c,0x32,0x35,0x4a,0x4d,0x53,0x54,0x60,0x67,0x79,0x7e},
{0x02,0x05,0x1b,0x1c,0x28,0x2f,0x31,0x36,0x49,0x4e,0x50,0x57,0x63,0x64,0x7a,0x7d},
{0x08,0x0f,0x11,0x16,0x22,0x25,0x3b,0x3c,0x43,0x44,0x5a,0x5d,0x69,0x6e,0x70,0x77},
{0x0b,0x0c,0x12,0x15,0x21,0x26,0x38,0x3f,0x40,0x47,0x59,0x5e,0x6a,0x6d,0x73,0x74},
{0x03,0x04,0x1a,0x1d,0x29,0x2e,0x30,0x37,0x48,0x4f,0x51,0x56,0x62,0x65,0x7b,0x7c},
{0x02,0x05,0x1b,0x1c,0x28,0x2f,0x31,0x36,0x49,0x4e,0x50,0x57,0x63,0x64,0x7a,0x7d},
{0x0a,0x0d,0x13,0x14,0x20,0x27,0x39,0x3e,0x41,0x46,0x58,0x5f,0x6b,0x6c,0x72,0x75},
{0x09,0x0e,0x10,0x17,0x23,0x24,0x3a,0x3d,0x42,0x45,0x5b,0x5c,0x68,0x6f,0x71,0x76}
};

main() {
	int rep, signmask, temp, i, j;
	printf("Rep# (0-29), signmask (0-127): ");
	scanf("%d, %x", &rep, &signmask);
	for(i=0; i< 16; i++)
	{
		temp = signmask ^ untwisteds[rep][i];
		for(j=0; j< 7; j++)
			if((temp ^ (1 << j)) == 0)
			{
				printf("%x =  %x ^ %x\n", signmask, untwisteds[rep][i], 1<< j);
				return;
			}
	}
}