Wednesday, 9 August 2023

Gray Code to the Rescue

Try as I might to find something interesting about the numerical properties of 27155, the number associated with my diurnal age yesterday, I couldn't. I looked through all my usual sources and spent quite time wracking my brain. Eventually I focused on the number's Gray Code. Follow the link for more information.

Because there is a 1-to-1 correspondence between a number and its Gray Code, I thought I'd look at the absolute value of the difference between the two. In the case of 27155, its Gray Code is 24346 and the difference is 2809. Fortunately, this number happens to be a perfect square \(53^2\). How often is this difference a perfect square was the next question that I asked myself.

It turns out that there are 359 such numbers in the range up to 40000. This represents 0.8975% of the range and so such numbers are relatively rare. Here is the list:

1, 2, 3, 6, 8, 9, 18, 24, 25, 32, 33, 47, 51, 54, 72, 73, 79, 96, 97, 128, 129, 159, 162, 211, 214, 216, 217, 227, 230, 271, 288, 289, 306, 338, 384, 385, 419, 422, 512, 513, 575, 578, 648, 649, 703, 706, 751, 787, 790, 856, 857, 864, 865, 883, 886, 920, 921, 1058, 1119, 1152, 1153, 1224, 1225, 1311, 1352, 1353, 1378, 1423, 1458, 1490, 1536, 1537, 1603, 1606, 1688, 1689, 1731, 1734, 1779, 1782, 1827, 1830, 1971, 1974, 2048, 2049, 2175, 2178, 2312, 2313, 2431, 2434, 2592, 2593, 2824, 2825, 3160, 3161, 3171, 3174, 3219, 3222, 3424, 3425, 3456, 3457, 3544, 3545, 3680, 3681, 3763, 3766, 3939, 3942, 3987, 3990, 4083, 4086, 4207, 4232, 4233, 4306, 4418, 4608, 4609, 4896, 4897, 5202, 5408, 5409, 5512, 5513, 5570, 5775, 5810, 5832, 5833, 5960, 5961, 6002, 6034, 6063, 6144, 6145, 6275, 6278, 6424, 6425, 6531, 6534, 6739, 6742, 6752, 6753, 6936, 6937, 7128, 7129, 7283, 7286, 7320, 7321, 7491, 7494, 7843, 7846, 7896, 7897, 7987, 7990, 8192, 8193, 8447, 8450, 8712, 8713, 8959, 8962, 9248, 9249, 9551, 9736, 9737, 10063, 10143, 10368, 10369, 10466, 10655, 10975, 11296, 11297, 11506, 11538, 11567, 11791, 11826, 12095, 12223, 12640, 12641, 12696, 12697, 12739, 12742, 12888, 12889, 13347, 13350, 13651, 13654, 13696, 13697, 13824, 13825, 14176, 14177, 14307, 14310, 14499, 14502, 14720, 14721, 14819, 14822, 15064, 15065, 15768, 15769, 15859, 15862, 15960, 15961, 16344, 16345, 16754, 16928, 16929, 17224, 17225, 17672, 17673, 17810, 17839, 17951, 18018, 18210, 18271, 18432, 18433, 19071, 19327, 19584, 19585, 20079, 20178, 20290, 20418, 20594, 20687, 20808, 20809, 21632, 21633, 22048, 22049, 22280, 22281, 22402, 22671, 22706, 23240, 23241, 23328, 23329, 23567, 23602, 23840, 23841, 24008, 24009, 24136, 24137, 24306, 24338, 24367, 24576, 24577, 24835, 24838, 25112, 25113, 25347, 25350, 25696, 25697, 26136, 26137, 26968, 26969, 27008, 27009, 27155, 27158, 27603, 27606, 27744, 27745, 27955, 27958, 28115, 28118, 28512, 28513, 28755, 28758, 29144, 29145, 29280, 29281, 29976, 29977, 30131, 30134, 31091, 31094, 31384, 31385, 31584, 31585, 31960, 31961, 32307, 32310, 32768, 32769, 33279, 33282, 33800, 33801, 34303, 34306, 34848, 34849, 35407, 35848, 35849, 36431, 36992, 36993, 37346, 37538, 38367, 38559, 38944, 38945, 39410, 39442, 39471

Looking at the numbers in this list, it is apparent that many of them occur in pairs or separated by 3. For example, the next number after 27155 is 27158 which has to do with the changing of the binary digits. I've added this sequence of numbers to my Bespoken for Sequences database as S085:

A variation on this idea is to consider those numbers whose difference with their Gray Code equivalents is a cube. There are 82 such numbers in the range up 40000. I've added this sequence of numbers to my Bespoken for Sequences database as S087:

The list is:

1, 2, 3, 6, 16, 17, 48, 49, 78, 91, 128, 129, 202, 215, 254, 263, 282, 384, 385, 624, 625, 779, 1024, 1025, 1616, 1617, 1775, 2032, 2033, 2256, 2257, 2718, 3072, 3073, 3410, 3706, 4394, 4855, 4992, 4993, 6739, 6742, 7079, 7903, 8192, 8193, 10722, 11747, 11750, 12928, 12929, 13115, 13166, 15850, 16256, 16257, 18048, 18049, 18618, 20091, 21744, 21745, 22503, 23470, 24223, 24576, 24577, 26531, 26534, 27280, 27281, 27554, 29648, 29649, 32307, 32310, 35152, 35153, 39442, 39471, 39936, 39937

The numbers together with their Gray Code equivalents, differences and cube root of differences are shown below:

[(1, 1, 0, 0), (2, 3, 1, 1), (3, 2, 1, 1), (6, 5, 1, 1), (16, 24, 8, 2), (17, 25, 8, 2), (48, 40, 8, 2), (49, 41, 8, 2), (78, 105, 27, 3), (91, 118, 27, 3), (128, 192, 64, 4), (129, 193, 64, 4), (202, 175, 27, 3), (215, 188, 27, 3), (254, 129, 125, 5), (263, 388, 125, 5), (282, 407, 125, 5), (384, 320, 64, 4), (385, 321, 64, 4), (624, 840, 216, 6), (625, 841, 216, 6), (779, 654, 125, 5), (1024, 1536, 512, 8), (1025, 1537, 512, 8), (1616, 1400, 216, 6), (1617, 1401, 216, 6), (1775, 1432, 343, 7), (2032, 1032, 1000, 10), (2033, 1033, 1000, 10), (2256, 3256, 1000, 10), (2257, 3257, 1000, 10), (2718, 4049, 1331, 11), (3072, 2560, 512, 8), (3073, 2561, 512, 8), (3410, 3067, 343, 7), (3706, 2375, 1331, 11), (4394, 6591, 2197, 13), (4855, 7052, 2197, 13), (4992, 6720, 1728, 12), (4993, 6721, 1728, 12), (6739, 6010, 729, 9), (6742, 6013, 729, 9), (7079, 5748, 1331, 11), (7903, 4528, 3375, 15), (8192, 12288, 4096, 16), (8193, 12289, 4096, 16), (10722, 15635, 4913, 17), (11747, 15122, 3375, 15), (11750, 15125, 3375, 15), (12928, 11200, 1728, 12), (12929, 11201, 1728, 12), (13115, 10918, 2197, 13), (13166, 10969, 2197, 13), (15850, 8991, 6859, 19), (16256, 8256, 8000, 20), (16257, 8257, 8000, 20), (18048, 26048, 8000, 20), (18049, 26049, 8000, 20), (18618, 27879, 9261, 21), (20091, 26950, 6859, 19), (21744, 32392, 10648, 22), (21745, 32393, 10648, 22), (22503, 31764, 9261, 21), (23470, 30329, 6859, 19), (24223, 29136, 4913, 17), (24576, 20480, 4096, 16), (24577, 20481, 4096, 16), (26531, 21618, 4913, 17), (26534, 21621, 4913, 17), (27280, 24536, 2744, 14), (27281, 24537, 2744, 14), (27554, 24179, 3375, 15), (29648, 19000, 10648, 22), (29649, 19001, 10648, 22), (32307, 16682, 15625, 25), (32310, 16685, 15625, 25), (35152, 52728, 17576, 26), (35153, 52729, 17576, 26), (39442, 55067, 15625, 25), (39471, 55096, 15625, 25), (39936, 53760, 13824, 24), (39937, 53761, 13824, 24)]

Another idea is to look at all those numbers whose Gray Codes are simply permutations of the number's original digits. It turns out that there are only 48 numbers with this property in the range up to 40000. I've added this sequence of numbers to my Bespoken for Sequences database as S086:


The list is as follows:

1, 54, 1126, 1488, 1489, 1636, 1637, 1746, 1812, 1813, 2351, 3272, 3273, 3492, 3624, 3625, 4356, 4659, 6544, 6545, 6902, 6985, 7051, 7248, 7249, 7520, 7550, 14184, 14185, 15041, 15101, 23500, 23501, 24219, 24907, 25173, 26519, 26635, 27402, 28213, 28292, 28293, 31428, 32157, 34305, 35258, 35380, 35411

Here are the numbers together with the permutated digits:

(1, 1), (54, 45), (1126, 1621), (1488, 1848), (1489, 1849), (1636, 1366), (1637, 1367), (1746, 1467), (1812, 1182), (1813, 1183), (2351, 3512), (3272, 2732), (3273, 2733), (3492, 2934), (3624, 2364), (3625, 2365), (4356, 6534), (4659, 6954), (6544, 5464), (6545, 5465), (6902, 6029), (6985, 5869), (7051, 5710), (7248, 4728), (7249, 4729), (7520, 5072), (7550, 5057), (14184, 11484), (14185, 11485), (15041, 10145), (15101, 10115), (23500, 30250), (23501, 30251), (24219, 29142), (24907, 20974), (25173, 21375), (26519, 21596), (26635, 23566), (27402, 24207), (28213, 22831), (28292, 22982), (28293, 22983), (31428, 18342), (32157, 17235), (34305, 50433), (35258, 52583), (35380, 53038), (35411, 53114)

No comments:

Post a Comment