Friday 26 January 2024

Revisiting Odds And Evens

It's been a while since I posted about so-called odds and evens by which I mean the process of generating a new number from an existing one by adding its sum of odd digits and subtracting it's sum of even digits. An an example, let's consider 1234:$$1234 \rightarrow 1234+1+3-2-4=1232$$As we continue this process interesting things happen and that's what I wrote about in a paper that I published to Academia (link). Here are links to posts I've made about the topic:

Of course, if the sums of the odd and even digits are the same, the number remains unchanged. These sorts of numbers are what I termed "attractors" because other numbers, wherein there is an imbalance of odds and evens, have either these as their termini or they enter "vortices" or loops. My diurnal age today, 27326, is one such attractor which is why I was reminded of them. $$27326 \rightarrow 27326 + 7 + 3-2-2-6=27326$$Until now, I wasn't aware that they had their own OEIS sequence but they do and it is OEIS A036301 (permalink):


 A036301

Numbers whose sum of even digits and sum of odd digits are equal. 
          


The initial members of the sequence are:

0, 112, 121, 134, 143, 156, 165, 178, 187, 211, 314, 336, 341, 358, 363, 385, 413, 431, 516, 538, 561, 583, 615, 633, 651, 718, 781, 817, 835, 853, 871, 1012, 1021, 1034, 1043, 1056, 1065, 1078, 1087, 1102, 1120, 1201, 1210, 1223, 1232, 1245, 1254, 1267, 1276, 1289, 1298

I also discovered a sequence connected to what I termed "vorticals". These are the numbers that comprise a vortex into which non-balanced numbers are sucked if they do not end up in an attractor. The first instance of a vortex is that involving the numbers 11 and 13:$$11 \rightarrow 11 + 1 + 1 = 13\\13 \rightarrow 13 + 1 + 3 =17\\ 17 \rightarrow 17+1+7 =25\\25 \rightarrow 25+5-2=28\\28 \rightarrow 28-2-8=18\\18 \rightarrow 18+1 -8=11$$Thus 11, 13, 17, 18, 25 and 28 are all numbers that eventually return to themselves after repeated mappings involving the odds and evens recursion. In the case of these numbers, six repetitions are needed: $$11 \rightarrow 13 \rightarrow 17 \rightarrow 25 \rightarrow 28 \rightarrow 18 \rightarrow 11$$Numbers like these are included in OEIS A124176:


 A124176

Consider the map \(f\) that sends \(m\) to \(m\) + (sum of odd digits of \(m\)) - (sum of even digits of \(m\)). Sequence gives numbers \(m\) such that \(f^k(m) \) = \(m\) for some \(k\).



This will include all the attractors, the numbers that aren't changed by the mapping and where \(k\)=1. The initial members are (permalink):

0, 11, 13, 17, 18, 25, 28, 54, 55, 64, 65, 112, 121, 134, 137, 143, 148, 155, 156, 165, 166, 173, 178, 184, 187, 198, 200, 209, 211, 216, 231, 233, 234, 237, 244, 245, 270, 275, 280, 285, 314, 336, 341, 358, 363, 385, 396, 402, 407, 410, 413, 429, 431, 432

All other numbers are what I termed "captives" because they are "captured" by either an attractor or a "vortex" that is comprised of "vorticals". The attractors and vorticals are all listed in OEIS A124176 and OEIS A036301 is a subset of this sequence because it contains only the attractors that are invariant under the mapping.

There are 2974 such numbers in the range up to 40,000. Here are the numbers from 27326 up to 40000 that belong in the sequence (for future reference):

27326, 27344, 27362, 27380, 27412, 27421, 27434, 27437, 27443, 27448, 27455, 27456, 27465, 27466, 27473, 27478, 27484, 27487, 27528, 27546, 27564, 27582, 27601, 27610, 27617, 27623, 27624, 27632, 27635, 27642, 27645, 27653, 27654, 27660, 27667, 27676, 27689, 27698, 27748, 27766, 27784, 27803, 27825, 27830, 27847, 27852, 27869, 27874, 27896, 27968, 27986, 27990, 28004, 28007, 28013, 28019, 28037, 28055, 28073, 28091, 28093, 28095, 28097, 28099, 28101, 28103, 28105, 28107, 28109, 28190, 28239, 28257, 28275, 28293, 28295, 28297, 28299, 28301, 28303, 28305, 28307, 28329, 28370, 28392, 28459, 28477, 28495, 28497, 28499, 28501, 28503, 28505, 28527, 28549, 28550, 28572, 28594, 28679, 28697, 28699, 28701, 28703, 28725, 28730, 28747, 28752, 28769, 28774, 28796, 28899, 28901, 28910, 28917, 28923, 28924, 28932, 28935, 28942, 28945, 28953, 28954, 28960, 28967, 28976, 28989, 28998, 29018, 29081, 29108, 29126, 29144, 29162, 29180, 29216, 29238, 29261, 29283, 29328, 29346, 29364, 29382, 29414, 29436, 29441, 29458, 29463, 29485, 29548, 29566, 29584, 29612, 29621, 29634, 29637, 29643, 29648, 29655, 29656, 29665, 29666, 29673, 29678, 29684, 29687, 29768, 29786, 29801, 29810, 29817, 29823, 29824, 29832, 29835, 29842, 29845, 29853, 29854, 29860, 29867, 29876, 29889, 29898, 29988, 30014, 30036, 30041, 30058, 30063, 30085, 30104, 30122, 30140, 30178, 30181, 30212, 30221, 30234, 30237, 30243, 30248, 30255, 30256, 30265, 30266, 30273, 30278, 30284, 30287, 30306, 30324, 30342, 30360, 30378, 30383, 30384, 30401, 30410, 30417, 30423, 30424, 30432, 30435, 30442, 30445, 30453, 30454, 30460, 30467, 30476, 30489, 30498, 30508, 30526, 30544, 30562, 30580, 30597, 30603, 30608, 30615, 30617, 30618, 30621, 30622, 30625, 30630, 30647, 30652, 30669, 30674, 30696, 30728, 30746, 30764, 30782, 30795, 30805, 30806, 30812, 30813, 30819, 30824, 30827, 30849, 30850, 30872, 30894, 30948, 30966, 30984, 31004, 31022, 31040, 31078, 31081, 31116, 31138, 31161, 31183, 31202, 31220, 31235, 31238, 31245, 31248, 31318, 31381, 31400, 31411, 31413, 31417, 31418, 31425, 31428, 31454, 31455, 31464, 31465, 31598, 31608, 31609, 31611, 31616, 31631, 31633, 31634, 31637, 31644, 31645, 31670, 31675, 31680, 31685, 31807, 31810, 31813, 31829, 31831, 31832, 31850, 31851, 31853, 31857, 31860, 31865, 32012, 32021, 32034, 32037, 32043, 32048, 32055, 32056, 32065, 32066, 32073, 32078, 32084, 32087, 32102, 32120, 32135, 32138, 32145, 32148, 32201, 32210, 32217, 32223, 32224, 32232, 32235, 32242, 32245, 32253, 32254, 32260, 32267, 32276, 32289, 32298, 32304, 32322, 32340, 32378, 32381, 32397, 32403, 32408, 32415, 32417, 32418, 32422, 32425, 32430, 32447, 32452, 32469, 32474, 32496, 32506, 32524, 32542, 32560, 32578, 32583, 32584, 32595, 32605, 32606, 32615, 32616, 32627, 32649, 32650, 32672, 32694, 32708, 32726, 32744, 32762, 32780, 32793, 32804, 32807, 32810, 32813, 32829, 32870, 32892, 32928, 32946, 32964, 32982, 33006, 33024, 33042, 33060, 33078, 33083, 33084, 33118, 33181, 33204, 33222, 33240, 33278, 33281, 33402, 33420, 33435, 33438, 33445, 33448, 33600, 33611, 33613, 33617, 33618, 33625, 33628, 33654, 33655, 33664, 33665, 33809, 33811, 33816, 33831, 33833, 33834, 33837, 33844, 33845, 33870, 33875, 33880, 33885, 34001, 34010, 34017, 34023, 34024, 34032, 34035, 34042, 34045, 34053, 34054, 34060, 34067, 34076, 34089, 34098, 34100, 34111, 34113, 34117, 34118, 34125, 34128, 34154, 34155, 34164, 34165, 34197, 34203, 34208, 34213, 34214, 34225, 34230, 34247, 34252, 34269, 34274, 34296, 34302, 34320, 34335, 34338, 34345, 34348, 34395, 34405, 34408, 34411, 34427, 34449, 34450, 34472, 34494, 34504, 34522, 34540, 34578, 34581, 34593, 34606, 34607, 34609, 34611, 34629, 34670, 34692, 34706, 34724, 34742, 34760, 34778, 34783, 34784, 34791, 34793, 34801, 34804, 34805, 34807, 34809, 34811, 34890, 34908, 34926, 34944, 34962, 34980, 35008, 35026, 35044, 35062, 35080, 35206, 35224, 35242, 35260, 35278, 35283, 35284, 35404, 35422, 35440, 35478, 35481, 35602, 35620, 35635, 35638, 35645, 35648, 35800, 35811, 35813, 35817, 35818, 35825, 35828, 35854, 35855, 35864, 35865, 36003, 36025, 36030, 36047, 36052, 36069, 36074, 36096, 36109, 36111, 36116, 36131, 36133, 36134, 36137, 36144, 36145, 36170, 36175, 36180, 36185, 36195, 36205, 36206, 36207, 36209, 36212, 36213, 36227, 36249, 36250, 36272, 36294, 36300, 36311, 36313, 36317, 36318, 36325, 36328, 36354, 36355, 36364, 36365, 36393, 36399, 36403, 36404, 36405, 36407, 36417, 36418, 36429, 36470, 36492, 36502, 36520, 36535, 36538, 36545, 36548, 36591, 36593, 36597, 36601, 36602, 36603, 36605, 36607, 36609, 36612, 36615, 36690, 36704, 36722, 36740, 36778, 36781, 36789, 36794, 36795, 36803, 36806, 36813, 36906, 36924, 36942, 36960, 36978, 36983, 36984, 37028, 37046, 37064, 37082, 37208, 37226, 37244, 37262, 37280, 37406, 37424, 37442, 37460, 37478, 37483, 37484, 37604, 37622, 37640, 37678, 37681, 37802, 37820, 37835, 37838, 37845, 37848, 37995, 38005, 38006, 38012, 38013, 38027, 38028, 38049, 38050, 38072, 38094, 38107, 38110, 38113, 38129, 38131, 38132, 38150, 38151, 38153, 38157, 38160, 38165, 38193, 38195, 38199, 38201, 38203, 38204, 38205, 38207, 38210, 38213, 38229, 38270, 38292, 38309, 38311, 38316, 38331, 38333, 38334, 38337, 38344, 38345, 38370, 38375, 38380, 38385, 38391, 38399, 38402, 38409, 38412, 38415, 38490, 38500, 38511, 38513, 38517, 38518, 38525, 38528, 38554, 38555, 38564, 38565, 38589, 38590, 38591, 38595, 38599, 38600, 38601, 38603, 38607, 38609, 38614, 38617, 38702, 38720, 38735, 38738, 38745, 38748, 38774, 38779, 38787, 38788, 38789, 38792, 38797, 38801, 38808, 38815, 38904, 38922, 38940, 38978, 38981, 39048, 39066, 39084, 39228, 39246, 39264, 39282, 39408, 39426, 39444, 39462, 39480, 39606, 39624, 39642, 39660, 39678, 39683, 39684, 39804, 39822, 39840, 39878, 39881

Of course, the choice of adding the odd digits and subtracting the even digits is quite arbitrary and it's perfectly acceptable to reverse this and in doing so generate a different sequence. Doing this we generate OEIS A124177:


 A124177

Consider the map \(f\) that sends \(m\) to \(m\) + (sum of even digits of \(m\)) - (sum of odd digits of \(m\) ). Sequence gives numbers \(m\) such that \(f^k(m)\) = \(m\) for some \(k\).


The initial members of this sequence are:

0, 22, 26, 27, 34, 35, 44, 49, 52, 63, 66, 78, 79, 81, 88, 99, 104, 107, 108, 112, 115, 121, 126, 133, 134, 143, 144, 151, 156, 165, 178, 187, 211, 224, 229, 232, 233, 283, 290, 314, 336, 341, 358, 363, 385, 413, 431, 467, 470, 489, 492, 516, 538, 561, 583, 615

Let's look at the first member of the sequence, 22:$$22 \rightarrow 22 + 2 + 2 =26\\26 \rightarrow 26+2+6=34\\34 \rightarrow 34 + 4 - 3 = 35\\35 \rightarrow 35-3-5=27\\27 \rightarrow 27+2-7=22$$Thus after five steps we arrive back at 22:$$22 \rightarrow 26 \rightarrow 34 \rightarrow 35 \rightarrow 27 \rightarrow 22$$It can be noted that "attractors", those numbers invariant under the mapping, remain the same but the "vorticals", those numbers that form "vortices" or loops, are different. There are 2966 members of this sequence in the range up to 40,000. For future reference, here are the members from 27326 to 40000:

27326, 27344, 27362, 27380, 27408, 27412, 27415, 27421, 27426, 27433, 27434, 27443, 27444, 27451, 27456, 27465, 27478, 27487, 27528, 27546, 27564, 27582, 27601, 27610, 27623, 27628, 27632, 27639, 27645, 27646, 27654, 27657, 27664, 27667, 27675, 27676, 27682, 27688, 27689, 27693, 27698, 27705, 27748, 27766, 27784, 27803, 27825, 27830, 27847, 27852, 27869, 27874, 27884, 27886, 27896, 27899, 27903, 27968, 27986, 28019, 28037, 28055, 28073, 28091, 28109, 28190, 28239, 28257, 28275, 28293, 28307, 28329, 28370, 28392, 28459, 28477, 28495, 28505, 28527, 28549, 28550, 28572, 28594, 28679, 28697, 28703, 28725, 28730, 28747, 28752, 28769, 28774, 28784, 28796, 28799, 28899, 28901, 28910, 28923, 28928, 28932, 28939, 28945, 28946, 28954, 28957, 28964, 28967, 28975, 28976, 28982, 28989, 28993, 28998, 29018, 29081, 29108, 29126, 29144, 29162, 29180, 29216, 29238, 29261, 29283, 29328, 29346, 29364, 29382, 29414, 29436, 29441, 29458, 29463, 29485, 29488, 29501, 29548, 29566, 29584, 29608, 29612, 29615, 29621, 29626, 29633, 29634, 29643, 29644, 29651, 29656, 29665, 29678, 29687, 29768, 29786, 29801, 29810, 29823, 29828, 29832, 29839, 29845, 29846, 29854, 29857, 29864, 29867, 29875, 29876, 29882, 29889, 29893, 29898, 29988, 30014, 30036, 30041, 30058, 30063, 30085, 30104, 30118, 30121, 30122, 30140, 30162, 30166, 30167, 30174, 30181, 30184, 30192, 30208, 30212, 30215, 30221, 30226, 30233, 30234, 30243, 30244, 30251, 30256, 30265, 30278, 30287, 30288, 30294, 30303, 30306, 30324, 30342, 30360, 30382, 30383, 30386, 30394, 30401, 30410, 30423, 30428, 30432, 30439, 30445, 30446, 30454, 30457, 30464, 30467, 30475, 30476, 30482, 30486, 30489, 30492, 30493, 30498, 30501, 30508, 30526, 30544, 30562, 30580, 30603, 30625, 30630, 30647, 30652, 30669, 30674, 30684, 30696, 30699, 30728, 30746, 30764, 30782, 30805, 30827, 30849, 30850, 30872, 30888, 30894, 30909, 30948, 30966, 30984, 31004, 31018, 31021, 31022, 31040, 31062, 31066, 31067, 31074, 31081, 31084, 31092, 31116, 31138, 31161, 31183, 31202, 31220, 31242, 31243, 31246, 31251, 31254, 31264, 31265, 31272, 31318, 31381, 31400, 31422, 31426, 31427, 31434, 31435, 31444, 31449, 31452, 31463, 31466, 31478, 31479, 31481, 31488, 31499, 31504, 31611, 31624, 31629, 31632, 31633, 31683, 31690, 31813, 31831, 31867, 31870, 31889, 31892, 32008, 32012, 32015, 32021, 32026, 32033, 32034, 32043, 32044, 32051, 32056, 32065, 32078, 32087, 32102, 32120, 32142, 32143, 32146, 32151, 32154, 32164, 32165, 32172, 32201, 32210, 32223, 32228, 32232, 32239, 32245, 32246, 32254, 32257, 32264, 32267, 32275, 32276, 32282, 32289, 32293, 32298, 32304, 32318, 32321, 32322, 32340, 32362, 32366, 32367, 32374, 32381, 32384, 32392, 32403, 32425, 32430, 32447, 32452, 32469, 32474, 32484, 32488, 32492, 32494, 32496, 32499, 32506, 32507, 32524, 32542, 32560, 32582, 32583, 32586, 32594, 32605, 32627, 32649, 32650, 32672, 32686, 32690, 32692, 32694, 32696, 32698, 32702, 32705, 32708, 32726, 32744, 32762, 32780, 32807, 32829, 32870, 32888, 32892, 32898, 32899, 32904, 32911, 32928, 32946, 32964, 32982, 33006, 33024, 33042, 33060, 33082, 33083, 33086, 33094, 33118, 33181, 33204, 33218, 33221, 33222, 33240, 33262, 33266, 33267, 33274, 33281, 33284, 33292, 33402, 33420, 33442, 33443, 33446, 33451, 33454, 33464, 33465, 33472, 33600, 33622, 33626, 33627, 33634, 33635, 33644, 33649, 33652, 33663, 33666, 33678, 33679, 33681, 33688, 33695, 33704, 33811, 33824, 33829, 33832, 33833, 33883, 33890, 34001, 34010, 34023, 34028, 34032, 34039, 34045, 34046, 34054, 34057, 34064, 34067, 34075, 34076, 34082, 34089, 34093, 34098, 34100, 34122, 34126, 34127, 34134, 34135, 34144, 34149, 34152, 34163, 34166, 34178, 34179, 34203, 34225, 34230, 34247, 34252, 34269, 34274, 34284, 34296, 34298, 34299, 34300, 34302, 34320, 34342, 34343, 34346, 34351, 34354, 34364, 34365, 34372, 34405, 34427, 34449, 34450, 34472, 34494, 34496, 34498, 34500, 34502, 34504, 34518, 34521, 34522, 34540, 34562, 34566, 34567, 34574, 34581, 34584, 34592, 34607, 34629, 34670, 34692, 34694, 34696, 34698, 34700, 34702, 34704, 34706, 34724, 34742, 34760, 34782, 34783, 34786, 34794, 34809, 34890, 34892, 34894, 34896, 34898, 34900, 34902, 34904, 34906, 34908, 34926, 34944, 34962, 34980, 35008, 35026, 35044, 35062, 35080, 35206, 35224, 35242, 35260, 35282, 35283, 35286, 35294, 35404, 35418, 35421, 35422, 35440, 35462, 35466, 35467, 35474, 35481, 35484, 35492, 35602, 35620, 35642, 35643, 35646, 35651, 35654, 35664, 35665, 35672, 35800, 35822, 35826, 35827, 35834, 35835, 35844, 35849, 35852, 35863, 35866, 35878, 35879, 35881, 35888, 35891, 35904, 36003, 36025, 36030, 36047, 36052, 36069, 36074, 36084, 36096, 36099, 36111, 36124, 36129, 36132, 36133, 36183, 36190, 36205, 36227, 36249, 36250, 36272, 36294, 36300, 36322, 36326, 36327, 36334, 36335, 36344, 36349, 36352, 36363, 36366, 36378, 36379, 36407, 36429, 36470, 36492, 36498, 36502, 36504, 36506, 36507, 36510, 36520, 36542, 36543, 36546, 36551, 36554, 36564, 36565, 36572, 36609, 36690, 36696, 36700, 36702, 36704, 36718, 36721, 36722, 36740, 36762, 36766, 36767, 36774, 36781, 36784, 36792, 36894, 36900, 36906, 36924, 36942, 36960, 36982, 36983, 36986, 36994, 37028, 37046, 37064, 37082, 37208, 37226, 37244, 37262, 37280, 37406, 37424, 37442, 37460, 37482, 37483, 37486, 37494, 37604, 37618, 37621, 37622, 37640, 37662, 37666, 37667, 37674, 37681, 37684, 37692, 37802, 37820, 37842, 37843, 37846, 37851, 37854, 37864, 37865, 37872, 38005, 38027, 38049, 38050, 38072, 38094, 38113, 38131, 38167, 38170, 38189, 38192, 38207, 38229, 38270, 38292, 38311, 38324, 38329, 38332, 38333, 38383, 38390, 38409, 38490, 38500, 38522, 38526, 38527, 38534, 38535, 38544, 38549, 38552, 38563, 38566, 38578, 38579, 38698, 38702, 38707, 38708, 38714, 38715, 38720, 38742, 38743, 38746, 38751, 38754, 38764, 38765, 38772, 38896, 38904, 38906, 38908, 38909, 38912, 38918, 38921, 38922, 38940, 38962, 38966, 38967, 38974, 38981, 38984, 38988, 38992, 39000, 39048, 39066, 39084, 39228, 39246, 39264, 39282, 39408, 39426, 39444, 39462, 39480, 39606, 39624, 39642, 39660, 39682, 39683, 39686, 39694, 39804, 39818, 39821, 39822, 39840, 39862, 39866, 39867, 39874, 39881, 39884, 39892

No comments:

Post a Comment