Showing posts with label loops. Show all posts
Showing posts with label loops. Show all posts

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:$$ \begin{align} 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 \end{align}$$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:$$ \begin{align} 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 \end{align}$$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

Saturday, 12 March 2022

Second Order Odds and Evens Trajectory for Numbers 1 to 99

In my previous post titled Higher Order Odds and Evens Trajectory, I looked specifically at the trajectory of the number 26638 under the recursive rule that:

number --> number + \( \sum d_o^k - \sum d_e^k \) with \(k \geq 1\)

where \( d_o^k \) are the number's odd digits raised to the power \( k\) and \( d_e^k \) are the number's even digits raised to the power \( k\).  In that post, I looked at the behaviour for \(2 \leq k \leq 5 \). I've looked at the case of \(k=1\) for a wide variety of numbers in several posts back in 2021 so in this post I'm focusing on values of \(k=2\) and looking only at the numbers from 1 to 99. Thus the recursive rule here is:

number --> number + \( \sum d_o^2 - \sum d_e^2 \) 

The trajectory of 1 when \(k=2\) requires 35 steps to reach the loop {327, 381}, acquiring a maximum value of 428 in the process. See Figure 1.


Figure 1

The full details of the trajectory of 1 are as follows:

1, 2, -2, -6, -42, -62, -102, -105, -79, 51, 77, 175, 250, 271, 317, 376, 398, 424, 388, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 2 is almost identical to that of 1 after only one step (shown in blue):

2, -2, -6, -42, -62, -102, -105, -79, 51, 77, 175, 250, 271, 317, 376, 398, 424, 388, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 3 eventually overlaps the trajectory of 1 and 2 (shown in blue):

3, 12, 9, 90, 171, 222, 210, 207, 252, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 4 also overlaps the trajectory of 1 (shown in blue) and is 49 steps in length:

4, -12, -15, 11, 13, 23, 28, -40, -56, -67, -54, -45, -36, -63, -90, -9, 72, 117, 168, 69, 114, 100, 101, 103, 113, 124, 105, 131, 142, 123, 129, 207, 252, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 5 is quite short, at 22 steps, and it too overlaps the trajectory of 1 (shown in blue):

5, 30, 39, 129, 207, 252, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 6 is 42 steps long and also overlaps the trajectory of 1 (shown in blue):

6, -30, -21, -24, -44, -76, -63, -90, -9, 72, 117, 168, 69, 114, 100, 101, 103, 113, 124, 105, 131, 142, 123, 129, 207, 252, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 7 is 29 steps in length and overlaps the trajectory of 1 (shown in blue):

7, 56, 45, 54, 63, 36, 9, 90, 171, 222, 210, 207, 252, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 8 is 42 steps in length and overlaps the trajectory of 1 (shown in blue):

8, -56, -67, -54, -45, -36, -63, -90, -9, 72, 117, 168, 69, 114, 100, 101, 103, 113, 124, 105, 131, 142, 123, 129, 207, 252, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

The trajectory of 9 is 23 steps in length and overlaps the trajectory of 1 (shown in blue):

9, 90, 171, 222, 210, 207, 252, 269, 310, 320, 325, 355, 414, 383, 337, 404, 372, 426, 370, 428, 344, 321, 327, 381, 327

14 is the next number of interest:

Without listing the trajectories for 10, 11, 12 and 13, it can be noted that all of their trajectories overlap that of 1. However, once we reach 14, there is a new development. The trajectory is 14, -1, 0. What happens of course is that -1 is reached and after that the trajectory is stuck on 0. See Figure 2.


Figure 2

22 and 42  are the next numbers of interest:

After this the trajectories for 15, 16, 17, 18, 19, 20 and 21 all overlap that of 1. Once 22 is reached, the same situation as with 14 prevails. The trajectory of 22 is 22, 14, -1, 0. After 22, all trajectories overlap again with that of 1 until 42 is reached and the trajectory once again plummets to zero: 42, 22, 14, -1, 0, 0.

50 is the next number of interest:

It is only when 50 is reached that we get a new trajectory. See Figure 3.


Figure 3

Once again a loop is reached but this time it is {573, 656, 609, 654, 627, 636}. The full trajectory is:

50, 75, 149, 215, 237, 291, 369, 423, 412, 393, 492, 553, 612, 573, 656, 609, 654, 627, 636, 573

62 and 75 are the next numbers of interest:

From 51 to 61, the trajectories again overlap that of 1 but at 62 it plummets to zero with a trajectory of 62, 22, 14, -1, 0, 0. From 62 to 74, the trajectory overlaps that of 1 until, at 75, the trajectory overlaps that of 50 as can be expected because 50 --> 75:

75, 149, 215, 237, 291, 369, 423, 412, 393, 492, 553, 612, 573, 656, 609, 654, 627, 636, 573

82 and 92 are the next numbers of interest:

From 76 to 81 we're back to overlapping the trajectory of 1 and at 82 we go to zero again with 82, 14, -1, 0, 0. From 83 to 91, we are back to overlapping the trajectory of 1 but at 92 we overlap the trajectory of 50 and 75 (shown in blue):

92, 169, 215, 237, 291, 369, 423, 412, 393, 492, 553, 612, 573, 656, 609, 654, 627, 636, 573

The remaining trajectories for 93 to 99 all overlap the trajectory of 1. These results for the numbers 1 to 99 can be summarised as follows:

  • 50, 75 and 92 end in the loop {573, 656, 609, 654, 627, 636}
  • 14, 22, 62 and 82 end in 0
  • all other numbers end in the loop {327, 381}
The general observation can be made that with \(k=2\) the numbers in the trajectory sequence will eventually rise because any negative odd digits (odd digits always predominate), will become positive when squared. This is not the case of course when \(k=3\) and we will look at this in a subsequent post.

Wednesday, 9 March 2022

Higher Order Odds and Evens Trajectory

My previous post on higher order Smith numbers gave me the idea to look into what happens with the odd and even trajectory of numbers when the squares of the digits are added or subtracted instead of just the digits themselves. The odd and even rule applied repeatedly to a number \(n\) is simply to add to \(n\) its odd digits and subtract its even ones. I've devoted numerous posts to the analysis of what happens beginning with my post titled Odds and Evens on June 17th 2021.

Numbers whose sum of odd and even digits is equal are not altered when this rule is applied. 112 is an example of such a number and numbers of this type I termed attractors. Other numbers follow a trajectory that either leads them to an attractor or else they enter a loop. Such a loop I termed a vortex and the numbers that comprise a vortex I termed vorticals. 

101 is an example of a number whose trajectory leads to an attractor, in this case 134. Here is its trajectory: 101, 103, 107, 115, 122, 119, 130, 134. 199 is an example of a number that enters a vortex. Its trajectory is 199, 218, 209, 216, 209. Here we see that {209, 216} is the vortex and the vorticals are 209 and 216. Numbers whose trajectories lead to attractors or vortices I've termed captives.

The purpose of this post is to explore what happens when, instead of adding just the odd digit or subtracting the even digit, we add higher powers of those digits. Let's begin by looking at what happens to the number associated with my diurnal age today viz. 26638. Under the odd and even rule, the trajectory is 26638, 26619, 26615, 26607, 26600, 26586, 26569. The trajectory leads to the attractor 26569 that has a total of 92 captives.

What if the squares of the digits are added and subtracted? Well the trajectory then becomes 26638, 26507, 26541, 26511, 26498, 26459, 26509, 26575, 26634, 26551, 26562, 26507 and it can be seen that the trajectory immediately enters a loop or vortex {26507, 26541, 26511, 26498, 26459, 26509, 26575, 26634, 26551, 26562}. 

Let's try with the cubes of the digits. In this case, we end up with an impressively long trajectory:

26638, 25713, 26201, 25970, 27159, 28349, 28521, 28119, 28330, 27864, 27407, 28021, 27494, 28430, 27873, 28066, 27114, 27387, 27580, 27528, 27468, 27011, 27348, 27134, 27433, 27758, 28049, 28194, 28340, 27783, 27976, 29167, 30016, 29828, 29517, 30707, 31420, 31376, 31558, 31324, 31307, 31705, 32201, 32213, 32252, 32380, 31914, 32608, 31899, 32873, 32750, 33237, 33653, 33643, 33444, 33306, 33171, 33570, 34092, 34776, 35209, 36082, 35373, 35922, 36787, 36772, 37261, 37408, 37202, 37556, 37960, 38843, 37809, 38396, 38451, 38028, 37023, 37412, 37711, 38426, 37653, 37959, 39912, 41390, 42083, 41526, 41364, 41048, 40409, 41010, 40948, 41037, 41344, 41180, 40606, 40110, 40048, 39408, 39588, 39445, 40198, 40352, 40432, 40323, 40305, 40393, 41112, 41043, 40943, 41571, 41977, 43329, 44040, 43848, 42723, 43013, 43004, 42903, 43587, 43506, 43378, 43199, 44621, 44270, 44477, 44971, 45916, 46491, 46877, 46771, 47178, 47289, 47777, 49085, 49363, 49866, 49587, 50208, 49813, 49994, 52053, 52322, 52450, 52628, 52009, 52855, 52710, 53171, 53668, 52876, 52608, 51997, 53924, 54733, 55191, 56172, 56417, 56606, 56083, 55507, 56225, 56243, 56107, 56360, 56080, 55477, 56349, 56950, 57713, 58552, 58407, 58299, 59362, 60019, 60533, 60496, 60729, 61577, 62173, 62320, 62115, 62018, 61283, 60575, 60952, 61582, 60972, 61820, 61085, 60483, 59718, 60404, 60060, 59628, 59746, 60663, 60042, 59754, 61012, 60790, 61646, 60935, 61600, 61169, 61468, 60461, 59966, 61117, 61247, 61303, 61142, 60856, 60037, 60191, 60706, 60617, 60529, 61159, 61799, 63385, 62836, 61911, 62427, 62474, 62465, 62086, 61134, 60883, 59670, 60651, 60345, 60217, 60337, 60518, 59916, 61284, 60485, 59818, 59649, 60952

As can be seen, the trajectory of 238 steps finally enters a loop or vortex {60952 ... 59649}. Figure 1 shows a plot of the trajectory.


Figure 1: permalink

When we try with fourth powers we find that the trajectory consists of 599 steps:

26638, 20015, 20625, 19922, 33013, 33257, 36429, 41503, 41954, 48629, 49526, 55144, 55883, 49022, 55295, 63715, 65527, 67866, 62283, 56940, 62574, 64032, 62545, 62227, 63284, 57701, 63129, 68460, 61516, 59551, 67988, 67462, 66999, 84090, 86299, 94013, 100400, 100145, 100516, 99847, 111018, 106926, 110880, 102690, 107940, 116647, 116202, 114876, 111631, 110420, 110150, 110778, 111486, 105841, 102116, 100807, 99113, 112318, 108290, 110740, 112887, 107082, 105372, 108464, 102561, 101876, 98887, 95561, 102077, 106864, 99921, 119589, 129242, 135500, 136832, 131587, 130600, 129386, 130621, 129392, 142564, 141366, 138601, 133292, 139984, 148836, 139174, 147963, 155455, 157700, 163128, 157803, 156815, 152675, 155015, 156892, 158671, 156307, 158119, 161212, 159887, 161283, 155958, 160299, 172110, 174498, 178853, 173769, 183918, 182370, 180741, 178792, 186044, 180141, 175792, 187765, 187801, 182012, 177886, 173201, 175669, 182665, 176587, 176623, 176498, 179813, 184762, 181500, 178031, 176419, 183831, 175803, 174815, 173491, 182280, 174057, 179229, 194721, 203413, 203304, 203194, 209565, 216064, 213201, 213252, 213911, 220540, 220877, 221551, 222771, 227526, 229208, 231625, 231004, 230814, 226528, 221713, 224165, 223207, 225641, 224683, 219084, 221278, 219536, 225492, 232374, 234649, 239467, 246942, 251663, 249762, 257140, 259895, 270155, 273791, 285220, 281701, 279992, 302044, 301597, 311266, 308741, 306872, 303946, 309117, 318162, 312837, 311289, 313821, 309873, 314901, 321289, 323804, 319598, 329331, 336120, 334971, 343840, 339394, 352503, 353899, 363712, 364964, 368502, 363800, 358570, 358206, 353504, 354660, 352518, 349738, 354510, 355586, 352150, 353466, 351405, 352481, 348820, 340437, 342488, 333849, 336301, 335249, 342325, 342824, 338265, 333644, 332079, 341187, 339319, 352685, 348608, 338945, 341941, 348073, 346284, 340445, 340383, 336274, 337269, 345081, 341436, 339791, 355477, 361354, 360590, 366561, 363380, 358231, 354907, 364319, 369491, 381143, 376955, 385952, 389732, 394744, 403019, 409406, 414159, 420835, 417173, 421802, 417419, 425871, 424530, 424708, 422485, 418470, 416264, 413145, 413341, 412993, 425925, 433448, 428746, 425227, 427949, 442944, 448465, 442930, 449044, 454581, 451224, 451306, 450461, 449279, 464274, 464595, 470598, 475833, 474669, 480527, 479185, 484421, 479542, 488601, 478858, 469340, 474174, 478209, 482803, 474420, 476037, 479368, 482763, 479581, 484817, 478515, 477815, 478891, 479406, 486560, 480241, 475618, 472997, 490649, 501963, 507935, 518228, 510630, 510041, 510412, 510767, 514899, 524295, 531818, 524334, 524593, 532213, 532969, 545485, 542752, 546115, 545815, 543339, 550512, 552372, 556072, 558411, 555311, 557269, 566169, 569468, 569710, 578002, 576916, 583912, 587068, 580606, 574543, 577763, 584376, 581835, 574975, 587332, 586408, 577289, 585165, 581649, 583188, 571607, 575739, 588433, 580772, 582087, 576905, 585821, 578864, 572146, 573605, 576041, 577516, 582273, 581252, 578375, 580412, 576670, 579505, 590342, 597337, 609487, 612801, 607395, 615767, 618603, 611997, 626226, 622290, 627507, 631622, 629080, 630233, 629164, 632862, 626223, 623664, 619585, 622005, 621302, 620056, 618073, 615164, 612943, 618018, 608532, 603830, 598600, 600394, 605484, 600205, 599518, 609795, 624647, 623928, 625146, 622908, 624045, 622846, 615870, 613505, 613541, 612697, 619052, 624927, 632305, 631780, 628871, 621769, 628124, 622445, 621230, 619984, 627459, 635478, 632937, 640749, 647903, 655394, 661734, 661369, 664124, 661005, 659039, 671571, 675704, 679579, 696832, 696770, 705541, 708937, 716285, 713904, 722692, 730310, 732874, 733389, 738498, 739093, 754778, 758254, 757537, 766071, 768282, 761163, 761055, 763411, 764343, 765098, 769293, 783585, 779125, 791098, 802526, 797727, 813876, 806871, 799785, 814238, 805856, 797618, 803590, 806761, 802475, 801133, 797201, 808549, 807287, 803881, 791675, 802368, 792945, 808821, 796518, 800714, 798764, 804479, 808833, 796707, 809175, 814667, 810125, 806640, 799696, 819188, 813463, 807978, 811149, 813361, 808133, 800104, 795753, 808447, 802144, 797521, 809494, 818008, 805721, 804636, 797773, 814019, 816230, 810904, 813114, 808846, 795006, 803297, 808228, 795908, 807960, 811530, 808142, 799679, 822868, 809252, 812310, 808281, 795978, 810431, 806162, 799459, 821912, 824347, 822205, 818686, 803807, 798097, 811925, 815001, 811532, 808128, 795825, 801925, 805000, 801529, 804604, 798700, 805967, 810162, 804756, 802134, 797848, 800763, 797853, 805826, 796947, 813319, 815948, 814687, 807345, 806100, 800709, 805575, 805755, 805935, 809731, 814679, 817994, 829166, 829024, 831201, 827172, 827847, 824185, 816347, 813182, 805057, 804612, 798949, 816681, 805899, 811454, 807473, 808004, 799556, 815033, 811725, 810641, 804995, 814390, 816681

Once again, a loop or vortex is entered {816681 ... 814390}. Figure 2 shows a plot of the trajectory.


Figure 2: permalink

With fifth powers, the trajectory is even longer (971 steps) and, as can be seen, the trajectory initially plunges into negative number territory.

26638, -21471, -37224, -53186, -16011, -8238, 57087, 61058, 23640, 15051, 21303, 21758, 8891, 2405, 4474, 18209, 44459, 103561, 99155, 223504, 225784, 211860, 171286, 147519, 225478, 211554, 216750, 228875, 183207, 167458, 145823, 115368, 78194, 120259, 182370, 166621, 143263, 134918, 160420, 151589, 184122, 150268, 112818, 47253, 66372, 67838, 11576, 23734, 39971, 175120, 195022, 257133, 277520, 314195, 375590, 457939, 595188, 594952, 718244, 700204, 715955, 801187, 752460, 763560, 768183, 711922, 787716, 797594, 951407, 1029365, 1083975, 1130432, 1129864, 1147315, 1166469, 1201168, 1160595, 1218120, 1185291, 1214668, 1165294, 1218638, 1145539, 1210059, 1272203, 1289158, 1285766, 1257347, 1293274, 1368286, 1287410, 1270395, 1349588, 1345446, 1337967, 1423341, 1421749, 1495527, 1576578, 1575899, 1684287, 1626727, 1644726, 1643902, 1694363, 1737323, 1771635, 1800843, 1734527, 1770454, 1805146, 1766705, 1787893, 1815264, 1776791, 1878487, 1812774, 1812566, 1767341, 1792400, 1867201, 1843434, 1808081, 1709779, 1878299, 1947637, 2031744, 2046715, 2057816, 2037173, 2071242, 2086930, 2105646, 2092164, 2142350, 2144631, 2135020, 2138325, 2109105, 2171249, 2246019, 2296205, 2350507, 2373775, 2427775, 2480233, 2446863, 2396706, 2457221, 2476034, 2483228, 2416815, 2378342, 2361779, 2446878, 2388293, 2382228, 2316807, 2293282, 2319678, 2355202, 2361599, 2475258, 2464459, 2515753, 2542147, 2559968, 2643740, 2650934, 2704519, 2782445, 2767497, 2868135, 2798160, 2833441, 2799080, 2901185, 2930561, 2985171, 3031354, 3034185, 3004005, 3006349, 3057084, 3043467, 3050936, 3105820, 3076389, 3112187, 3096440, 3145908, 3174534, 3192905, 3314340, 3313022, 3313688, 3241106, 3232519, 3295116, 3349727, 3441820, 3407216, 3415435, 3420124, 3418256, 3380025, 3350836, 3314146, 3304810, 3271505, 3294774, 3385600, 3348667, 3316616, 3293776, 3379117, 3472268, 3447686, 3414368, 3372263, 3381959, 3470901, 3545977, 3644109, 3693578, 3732501, 3752888, 3674727, 3716559, 3791133, 3867720, 3861001, 3820702, 3804920, 3830388, 3732813, 3717550, 3757658, 3757221, 3794140, 3868192, 3854141, 3822695, 3844504, 3812032, 3779687, 3848856, 3745120, 3764240, 3771434, 3803487, 3754220, 3773307, 3824457, 3809784, 3819323, 3846302, 3805188, 3710253, 3730640, 3739133, 3815962, 3837804, 3788537, 3760226, 3761660, 3755383, 3746401, 3753628, 3733470, 3766789, 3811375, 3799027, 3950950, 4075541, 4096551, 4153051, 4158522, 4130917, 4205994, 4325137, 4344500, 4344796, 4410047, 4423783, 4406228, 4363572, 4375158, 4364667, 4356341, 4350129, 4411491, 4467471, 4490238, 4514682, 4475184, 4459277, 4552985, 4587585, 4547207, 4581866, 4502880, 4439413, 4495877, 4556849, 4579556, 4655987, 4696525, 4745216, 4755293, 4836586, 4757842, 4759733, 4854983, 4849816, 4833506, 4795549, 4934656, 4979473, 5129380, 5158998, 5217811, 5204946, 5257264, 5271457, 5310266, 5298051, 5330551, 5340413, 5341977, 5436985, 5460959, 5576507, 5611720, 5623846, 5577838, 5552409, 5619777, 5724597, 5822454, 5793824, 5839224, 5867785, 5834337, 5821206, 5783724, 5786882, 5700702, 5737409, 5832416, 5794185, 5842500, 5814926, 5835501, 5812352, 5786014, 5764379, 5851610, 5817318, 5771959, 5929922, 6110098, 6128605, 6083379, 6119177, 6204067, 6204266, 6179850, 6218288, 6112145, 6106441, 6088843, 5981982, 6037638, 6006611, 5983285, 5983259, 6075050, 6090331, 6142091, 6192310, 6243796, 6303287, 6280004, 6238404, 6196023, 6239732, 6308234, 6267120, 6268312, 6220172, 6229108, 6247550, 6261775, 6282931, 6301616, 6278533, 6258375, 6241099, 6350366, 6330649, 6373608, 6342581, 6304350, 6299161, 6401677, 6418716, 6386181, 6305338, 6268648, 6178728, 6138999, 6275846, 6246402, 6228738, 6172412, 6180357, 6159989, 6299718, 6394048, 6410748, 6384964, 6393888, 6347343, 6355055, 6360022, 6344649, 6385317, 6365192, 6412026, 6395387, 6434310, 6424973, 6491216, 6533659, 6583892, 6572965, 6639487, 6666242, 6634050, 6620842, 6571434, 6581786, 6520631, 6508416, 6462198, 6471872, 6463887, 6398825, 6387898, 6357917, 6446173, 6445624, 6430093, 6480828, 6373692, 6434450, 6426970, 6486218, 6404075, 6414183, 6371836, 6340810, 6299486, 6368208, 6287331, 6264049, 6305466, 6284482, 6209058, 6230656, 6210664, 6186281, 6105163, 6092981, 6170504, 6181637, 6150369, 6197235, 6268652, 6215617, 6219967, 6339289, 6417297, 6501129, 6555497, 6631928, 6642869, 6644766, 6628421, 6579014, 6649196, 6742943, 6809186, 6787148, 6746427, 6762409, 6821657, 6793238, 6829004, 6846453, 6799453, 6928926, 6998640, 7067394, 7151500, 7174559, 7272449, 7363000, 7372517, 7426275, 7454150, 7475160, 7503100, 7523276, 7552418, 7541652, 7555878, 7533331, 7554236, 7568704, 7563875, 7563438, 7542288, 7495596, 7627951, 7715932, 7811932, 7855233, 7845976, 7900196, 8027326, 8003768, 7947506, 8034494, 8057946, 8095359, 8187182, 8105655, 8074487, 8040517, 8026658, 7948663, 7975418, 8037415, 8023799, 8126147, 8101356, 8064182, 7989815, 8062310, 8021978, 8032267, 8008709, 8019029, 8104328, 8037980, 8048543, 7984327, 8043409, 8067885, 7981737, 8058683, 7955971, 8113934, 8139679, 8234284, 8166879, 8161648, 8079538, 8093226, 8111910, 8138195, 8135078, 8089718, 8067271, 8060310, 8020010, 7987211, 8047076, 8039122, 8065583, 7998764, 8108908, 8069654, 8082484, 7982100, 8025157, 8015415, 7987875, 8034934, 8059653, 8084651, 8013441, 7978870, 8022804, 7956180, 7994618, 8087956, 8093625, 8115466, 8069249, 8145747, 8147671, 8139719, 8242101, 8208247, 8158430, 8095239, 8183905, 8180787, 8116098, 8101837, 8053353, 8027564, 8005896, 7994758, 8115803, 8053637, 8033511, 8004356, 7966156, 8021810, 7956244, 8025369, 8047210, 8030194, 8055695, 8083575, 8041339, 8067083, 8010821, 7945255, 8029430, 8054898, 8017744, 8016543, 7978344, 8036434, 7994328, 8095652, 8120375, 8107751, 8111724, 8094710, 8136775, 8133214, 8099878, 8136479, 8171011, 8155054, 8130638, 8057813, 8012453, 7981998, 8110417, 8093435, 8122303, 8089958, 8112877, 8080925, 8077531, 8081746, 8024218, 7957595, 8118682, 8012572, 7999673, 8202901, 8229119, 8314387, 8265121, 8227640, 8202815, 8140341, 8105770, 8109742, 8151775, 8158873, 8080745, 8034117, 8017377, 8035274, 8021625, 7984143, 8025427, 8011503, 7982105, 8028287, 7946726, 8022781, 7973989, 8152225, 8125612, 8088131, 7990072, 8141752, 8127862, 8071294, 8113327, 8097822, 8108078, 8026582, 7956331, 8028023, 7962666, 8007386, 7951124, 8029051, 8058426, 7987183, 8014554, 7985989, 8117532, 8104909, 8189216, 8174923, 8217199, 8319306, 8338298, 8299497, 8459627, 8497008, 8506304, 8468104, 8392745, 8438145, 8373930, 8417747, 8433353, 8403658, 8332690, 8351649, 8372499, 8473823, 8424524, 8391745, 8437178, 8404476, 8377667, 8380011, 8314720, 8297947, 8415835, 8355769, 8397574, 8459813, 8455671, 8437161, 8412645, 8373147, 8373456, 8352306, 8315341, 8285162, 8214912, 8240107, 8223091, 8249552, 8280995, 8336650, 8291941, 8376217, 8369499, 8505321, 8479015, 8524205, 8496599, 8635303, 8598613, 8587719, 8617972, 8670060, 8638547, 8584386, 8480650, 8409439, 8492964, 8568438, 8464702, 8438885, 8310157, 8297566, 8328195, 8325045, 8297714, 8356554, 8324604, 8282223, 8216802, 8143427, 8125630, 8088423, 7989306, 8083910, 8077667, 8079768, 8099119, 8243500, 8213044, 8178440, 8127664, 8095096, 8175775, 8199679, 8353090, 8382982, 8343906, 8361873, 8305855, 8249937, 8351261, 8314055, 8286757, 8250152, 8223571, 8210915, 8240291, 8265485, 8197367, 8249730, 8292005, 8321347, 8304817, 8255308, 8196233, 8215193, 8244812, 8177165, 8173362, 8150080, 8087670, 8047972, 8106811, 8033502, 8004313, 7971008, 8030904, 8056404, 8016937, 8052493, 8081086, 7975007, 8087602, 8031065, 7993890, 8155319, 8188095, 8151966, 8165822, 8095572, 8144878, 8061334, 8020253, 7990789, 8168782, 8079478, 8105581, 8046297, 8080553, 8021510, 7991837, 8111025, 8081353, 8019429, 8103704, 8086963, 8065167, 8036780, 7980518, 7993964, 8179361, 8214918, 8207377, 8225241, 8194479, 8294569, 8374192, 8416468, 8333333, 8302023, 8269677, 8313988, 8275220, 8262288, 8156112, 8118664, 8036554, 8001479, 8043544, 8011072, 7995081, 8100344, 8065772, 8061935, 8083809, 8044797, 8102644, 8060021, 8019446, 8035904, 8064529, 8085103, 8022936, 8041620, 8000021, 7967222, 8052013, 8022582, 7960075, 8048087, 7965566, 8024344, 7988715, 8018968, 7971938, 8091126, 8109601, 8128108, 8029774, 8088613, 7982777, 8076254, 8054586, 7986500, 8024937, 8067212, 8043412, 8008808, 7877736, 7904663, 7964186, 7990699, 8235926, 8257735, 8265042, 8226535, 8192420, 8217614, 8192823, 8186516, 8108555, 8052395, 8085137, 8039777, 8116722, 8092923, 8178432, 8128891, 8089606, 8067567, 8055986, 8047973, 8107087, 8075166, 8046779, 8097874, 8123977, 8184084, 8083733, 8035733, 8023626, 7975485, 8040606, 7991262, 8118328, 8020237, 8004455, 7975889, 8065190, 8086821, 7980710, 8040606

The trajectory once again enters a loop {8040606 ... 7980710}. Figure 3 shows the trajectory.



Figure 3: permalink

I'll leave off there and powers higher than 5 may prove rather unwieldy. It's not possible to make generalisations at this early stage but it would seem that the trajectories are far more volatile and lengthy once we start dealing with powers of digits. The trajectories may end up favouring vortices instead of attractors. 

One general observation is that the trajectories will always tend to rise rather than fall because there are the odd digits (1, 3, 5, 7 and 9) with an average value of 5 outweighing the even digits (0, 2, 4, 6, 8) with an average value of 4.

Thursday, 9 December 2021

Digit Sum Raised to Integer Powers

I'm familiar with what happens when the operation of sum of the digits squared is applied repeatedly to a number. Either the number 1 is reached or the loop {4, 16, 37, 58, 89, 145, 42, 20} is entered. Numbers that reach 1 are called happy numbers and I wrote about these in a blog post on June 26th 2018 titled Happy Numbers.

I hadn't considered what happens when the operation of digit sum squared is repeatedly applied. Let's highlight the difference between the two operations using my diurnal age of 26548 as an example.$$26548 \rightarrow 2^2+6^2+5^2+4^2+8^2=4+36+25+16+64=145\\26548 \rightarrow (2+6+5+4+8)^2=25^2=625$$In the case of the sum of the digits squared, it can be seen that continuing the operation leads to a loop because:$$145 \rightarrow 1^2+4^2+5^2=42$$However, in the case of the square of the digit sum, a loop is also entered because:$$625 \rightarrow (6+2+5)^2 = 169 \rightarrow (1+6+9)^2=256 \rightarrow (2+5+6)^2=169$$Nearly 45% of all numbers will enter this loop. Another 33% will end in 81. For example, 26547 follows this trajectory:$$26547 \rightarrow 576 \rightarrow 324 \rightarrow 81$$Another 22% will end in 1 and, in general, it seems that all numbers will either end in 1 or 81 or enter the loop {169, 256]. Here is a permalink to SageMathCell that will confirm this. The algorithm is easily modifiable to accommodate powers greater than 2 and so what happens if the digit sum is repeatedly raised to the third, fourth, fifth powers etc. can be investigated. Let's look next at the digit sum cubed.

What we find is that almost 32% of numbers enter the loop {6859, 21952}:$$6859 \rightarrow 28^3=21952 \rightarrow 19^3=6859$$All other numbers end in 1, 512, 4913, 5832, 17576 or 19683 with percentages of approximately 1.5%, 7.6%, 13.0%, 25.7%, 12.7% and 7.5% respectively:$$ \begin{align} 1 \rightarrow 1^3 &= 1\\512 \rightarrow 8^3 &= 512\\4913 \rightarrow 17^3 &= 4913\\5832 \rightarrow 18^3 &= 5832\\17576 \rightarrow 26^3 &= 17576\\19683 \rightarrow 27^3 &=19683 \end{align}$$When we raise the digit sum repeatedly to the fourth power, we find that again that some numbers enter the loop {104976, 531441}, about 33% in total:$$104976 \rightarrow 27^4= 531441 \rightarrow 18^4 = 104976$$All other numbers end in 1, 2401, 234256, 390625, 614656 or 1679616 with approximate percentages of 12.1%, 6.0%, 22.2%, 16.2%, 10.1% and 0.7% respectively:$$ \begin{align}1 \rightarrow 1^4 &= 1\\2401 \rightarrow 7^4 &= 2401\\234256 \rightarrow 22^4&= 234256\\ 390625 \rightarrow 25^4&= 390625\\614656 \rightarrow 28^4 &=614656\\ 1679616 \rightarrow 36^4 &=1679616 \end{align}$$When we raise the digit sum repeatedly to the fifth power, about 56% of numbers enter the loops {16807, 5153632, 9765625, 102400000} or {6436343, 20511149} or {28629151, 45435424}. All other numbers end in 1, 17210368, 52521875, 60466176 or 205962976 with approximate percentages of 1.0%, 4.3%, 11.1%, 33.3% and 5.8% respectively:$$ \begin{align}1 \rightarrow 1^5 &= 1\\17210368 \rightarrow 28^5 &= 17210368\\52521875 \rightarrow 35^5 &= 52521875\\60466176 \rightarrow 36^5&= 60466176\\205962976 \rightarrow 46^5 &=205962976\end{align}$$I could go on but the general pattern is clear.

Friday, 16 July 2021

Kaprekar's Routine

I first encountered the algorithm that Wolfram MathWorld calls Kaprekar's Routine last year and actually made a post about it titled Birth Year Magic. I've created this post because I was reminded of the similarity between Kaprekar's Routine and the Odd-Even Algorithm that I've written about in a number of previous posts:



Dattaraya Ramchandra Kaprekar is something of an inspiration for me because our situations are similar academic-wise.

In Kaprekar's Routine, numbers get mapped to what are called fixed points (attractors in my terminology) or end up in loops (vortices in my terminology). Here is what Wolfram MathWorld has to say about the algorithm:

The Kaprekar routine is an algorithm discovered in 1949 by D. R. Kaprekar for 4-digit numbers, but which can be generalised to \(k\)-digit numbers. To apply the Kaprekar routine to a number \(n\), arrange the digits in descending \( n^{'} \) and ascending \( n^{''} \) order. Now compute \( K(n)=n^{'}-n^{''} \) (discarding any initial 0s) and iterate, where \(K(n)\) is sometimes called the Kaprekar function. The algorithm reaches 0 (a degenerate case), a constant, or a cycle, depending on the number of digits in \(k\) and the value of \(n\). The list of values is sometimes called a Kaprekar sequence, and the result K(n) is sometimes called a Kaprekar number (Deutsch and Goldman 2004), though this nomenclature should be deprecated because of confusing with the distinct sort of Kaprekar number.

In base-10, the numbers n for which \(K(n)=n\) are given by 495, 6174, 549945, 631764, ... (OEIS A099009). Similarly, the numbers \(n\) for which iterating \(K(n)\) gives a cycle of length \(k \geq 2\) are given by 53955, 59994, 61974, 62964, 63954, 71973, ... (OEIS A099010).

Iterating the Kaprekar map in base-10, all 1- and 2-digit numbers give 0. Exactly 60 3-digit numbers, namely 100, 101, 110, 111, 112, 121, 122, 211, 212, 221, ... (OEIS A090429), reach 0, while the rest give 495 in at most 6 iterations. Exactly 77 4-digit numbers, namely 1000, 1011, 1101, 1110, 1111, 1112, 1121, 1211, ... (OEIS A069746), reach 0, while the remainder give 6174 in at most 8 iterations. The value 6174 is sometimes known as Kaprekar's constant (Deutsch and Goldman 2004). This pattern breaks down for 5-digit numbers, which may converge to 0 or one of the 10 constants 53955, 59994, 61974, 62964, 63954, 71973, 74943, 75933, 82962, 83952.

I developed an SageMath algorithm (permalink) to determine the behaviour of numbers of any length over a given range. In my earlier post, my algorithms only applied to three and four digit numbers. Here is the behaviour for numbers in the range from 26400 to 26425:

26400 --> [26400, 63954, 61974, 82962, 75933, 63954]

26401 --> [26401, 62964, 71973, 83952, 74943, 62964]

26402 --> [26402, 61974, 82962, 75933, 63954, 61974]

26403 --> [26403, 61974, 82962, 75933, 63954, 61974]

26404 --> [26404, 61974, 82962, 75933, 63954, 61974]

26405 --> [26405, 62964, 71973, 83952, 74943, 62964]

26406 --> [26406, 63954, 61974, 82962, 75933, 63954]

26407 --> [26407, 73953, 63954, 61974, 82962, 75933, 63954]

26408 --> [26408, 83952, 74943, 62964, 71973, 83952]

26409 --> [26409, 93951, 85932, 74943, 62964, 71973, 83952, 74943]

26410 --> [26410, 62964, 71973, 83952, 74943, 62964]

26411 --> [26411, 52965, 70983, 94941, 84942, 73953, 63954, 61974, 82962, 75933, 63954]

26412 --> [26412, 51975, 81972, 85932, 74943, 62964, 71973, 83952, 74943]

26413 --> [26413, 51975, 81972, 85932, 74943, 62964, 71973, 83952, 74943]

26414 --> [26414, 51975, 81972, 85932, 74943, 62964, 71973, 83952, 74943]

26415 --> [26415, 52965, 70983, 94941, 84942, 73953, 63954, 61974, 82962, 75933, 63954]

26416 --> [26416, 53955, 59994, 53955]

26417 --> [26417, 63954, 61974, 82962, 75933, 63954]

26418 --> [26418, 73953, 63954, 61974, 82962, 75933, 63954]

26419 --> [26419, 83952, 74943, 62964, 71973, 83952]

26420 --> [26420, 61974, 82962, 75933, 63954, 61974]

26421 --> [26421, 51975, 81972, 85932, 74943, 62964, 71973, 83952, 74943]

26422 --> [26422, 41976, 82962, 75933, 63954, 61974, 82962]

26423 --> [26423, 41976, 82962, 75933, 63954, 61974, 82962]

26424 --> [26424, 41976, 82962, 75933, 63954, 61974, 82962]

26425 --> [26425, 42966, 71973, 83952, 74943, 62964, 71973]

All the numbers end in a loop of one type or another. Let's compare what happens to today's number (I'm 26402 days old) under the two different algorithms:

  • Kaprekar's Routine:

    26402
    --> [26402, 61974, 82962, 75933, 63954, 61974]

  • Odd Even Algorithm: 

    26402
    -->[26402, 26388, 26367, 26363, 26355, 26360, 26349]
Kaprekar's Routine causes the number to end up in a loop [61974, 82962, 75933, 63954, 61974] while the Odd Even Algorithm leads to an attractor, or fixed point, 26349. Go back to my post Birth Year Magic to find out more about Kaprekar.

Thursday, 17 June 2021

Odds and Evens

Today, having turned 26372 days old, I set out finding something interesting about this number. There wasn't anything that caught my attention until I stumbled upon the information shown in Figure 1.


Figure 1

The site link that is displayed refuses to load but the purple print piqued my curiosity:

Add to n its odd digits and subtract its even ones

I realised that 26372 is special in this regard because its odd digits (3 and 7) add to 10 and its even digits (2, 6 and 2) also add to 10. The number is unaffected by this process of addition and subtraction. It might be termed stable under this process. What about other numbers that aren't stable? How many repetitions of the process are needed on average for a number to become a stable number? Are there some numbers that never become stable? What proportion of numbers are stable? That's what I set out to investigate in a SageMath program that examined the first 100,000 integers. Here is a permalink to that program. 

The output reveals that 88985, 88987 and 91055 produce record runs of 81 steps before reaching a stable number. The average run or trajectory length is 8.58. Figure 1 shows a plot of all trajectory lengths for numbers from 1 to 100000.


Figure 1: permalink

So how many numbers are stable in that range. Here is a permalink to another SageMath program that determines this. The answer turns out to 3725 or 3.725% of the numbers between 1 and 100,000. In the range from 1 to 1000, the numbers are:

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

These numbers form OEIS  A036301 but there is no further analysis done.


 A036301

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

Of the 3725 numbers between 1 and 100000 that are member of OEIS A036301, 301 are prime. Here is a permalink to a program that will verify this.

I wrote another program that displays the "trajectory" or path of a number on its journey from instability to stability or looping. Here is a permalink to this program. Applied to 88985, it can be seen that the trajectory is:

88985, 88975, 88980, 88965, 88957, 88962, 88947, 88943, 88935, 88936, 88926, 88911, 88906, 88893, 88881, 88850, 88831, 88811, 88789, 88781, 88765, 88755, 88756, 88746, 88727, 88723, 88715, 88712, 88702, 88691, 88679, 88673, 88661, 88634, 88611, 88591, 88590, 88588, 88561, 88545, 88535, 88532, 88522, 88507, 88503, 88495, 88489, 88470, 88457, 88449, 88434, 88413, 88397, 88400, 88380, 88359, 88360, 88341, 88325, 88315, 88308, 88287, 88268, 88236, 88215, 88203, 88188, 88157, 88154, 88140, 88121, 88105, 88095, 88093, 88089, 88074, 88061, 88040, 88020, 88002, 87984, 87980, 87980

After 81 steps, the stable number 87980 is reached. The table in Figure 2 shows that the numbers near 88985 and 88987 have mostly near-record trajectory lengths.


Figure 2

However, Figure 3 shows that 91055 is very much a singleton.


Figure 3

If the range is extended to 200,000, a new record of 91 is reached with 158893. The trajectory is:

158893, 158895, 158899, 158907, 158921, 158927, 158939, 158958, 158962, 158961, 158963, 158967, 158975, 158994, 159006, 159015, 159036, 159048, 159051, 159072, 159092, 159114, 159127, 159148, 159152, 159171, 159195, 159225, 159241, 159251, 159270, 159290, 159312, 159329, 159354, 159373, 159401, 159413, 159428, 159429, 159447, 159461, 159467, 159479, 159506, 159520, 159538, 159553, 159581, 159594, 159619, 159638, 159642, 159645, 159655, 159674, 159686, 159681, 159683, 159687, 159695, 159718, 159733, 159761, 159778, 159799, 159839, 159858, 159862, 159861, 159863, 159867, 159875, 159894, 159906, 159924, 159942, 159960, 159978, 160001, 159997, 160037, 160042, 160031, 160030, 160028, 160013, 160012, 160006, 159995, 160033, 160034, 160028

Interestingly, a stable number is not reached but instead a loop arises: 160028, 160013, 160012, 160006, 159995, 160033, 160034, 160028. So some numbers attain "stability" (such as 88985) while others enter a loop (such as 158893). 

Figure 4 is a plot of all trajectory lengths from 1 to 200,000:


Figure 4

Note that the average trajectory length has increased from 8.58 to 10.6 which makes sense. As numbers get bigger, it should take them longer to settle on a stable number or to enter a loop. It's difficult to explore beyond 200,000 because SageMathCell times out. 

I developed another algorithm to check on the relative proportions of numbers that end up as stable numbers versus ending in a loop. Here is a permalink. The results are as follows:

  • total of numbers ending in a stable number is 58977 up to 100000 or 59.0 percent
  • total of numbers ending in loop is 37298 up to 100000 or 37.3 percent
  • total number of stable numbers up to 100000 is 3725 or 3.73 percent
Figure 5 shows a graphical representation:

Figure 5

One general point to note about this odd-even recursive process is that there are five odd digits (1, 3, 5, 7 and 9) totalling 25 and four even digits (2, 4, 6 and 8) totalling 20. The process thus favours the progressive numbers getting larger rather than smaller. 

Some stable numbers attract unstable numbers far more strongly than others. Figure 6 shows a table listing the top "attractors". As can be seen, 87980 might be termed the Great Attractor with 881 unstable numbers being attracted to it. Here is a permalink to the program that created the information.


Figure 6: Google Sheet Link

Looking at all the data in the spreadsheet, 134 stands out because even though it is a small number, it attracts 74 unstable numbers.

Overall, it's clear than in terms of this odd-even recursive process there are three types of numbers:
  • numbers that remain unchanged by the process e.g. 112. 
  • numbers that are changed by the process and in the end become unchangeable numbers e.g. 114 becomes 112 in only one step of the process.
  • numbers that are changed by the process and in the end become trapped in a loop e.g. 5 which has a trajectory of 10, 11, 13, 17, 23, 24, 18, 11 and so becomes caught in a loop and never becomes an unchangeable.
We might call the first type of number immutable and the two other types mutable but differentiated by a prefix i-mutable and v-mutable where v stands for vortex (that these types of numbers are drawn into). So 112 could be described as an immutable number, 114 as i-mutable and 5 as v-mutable. These differentiators are speculative and might change but they do serve to clearly identify each type of number.

Another nomenclature that I considered was that of attractor and captive. It's as if the gravitational pull of an attractor (an immutable number in my previous nomenclature) pulls the i-mutable numbers to them and so in a sense they are captives of the attractor. The v-mutable numbers are also attracted by the vortices comprised of a series to two or more looping chains of numbers, each member of which might be termed a vortical. This could be explained as follows:
  • 112 is an attractor
  • 114 is a captive of the attractor 112
  • 5 is a captive of the vortex {10, 11, 13, 17, 23, 24, 18}
  • 10, 11, 13, 17, 23, 24 and 18 are vorticals comprising the vortex
In the past, my first response to a number was to consider whether it was prime or composite whereas now I'll be inclined to also consider whether it's mutable or immutable and, if the former, whether it is i-mutable or v-mutable OR I might just settle on attractor, captive and vortical.

Wednesday, 28 October 2020

Phi - Sigma Loops

Yesterday I turned 26140 days old and one of this number's properties is that it is a member of OEIS A095953:


A095953



Initial values for f(x) = phi(sigma(x)) such that iteration of f ends in a cycle of length 3.


In the case of 26140 we get:
  • \( \phi(\sigma_1(26140))=15552 \)
  • \( \phi(\sigma_1(15552))=18144 \)
  • \( \phi(\sigma_1(18144))=15840 \)
  • \( \phi(\sigma_1(15840))=15552 \)
Thus there is a cycle of length 3. 

This got me thinking about what other cycles exist. What I found was that cycles of 1, 2, 3, 4 and 6 are possible but not cycles of 5 or cycles greater than 6. Between 1 and 26200, the percentages for the cycles of 6, 4, 3, 2 and 1 are about 5.5%, 3.4%, 6.2%, 15.3% and 69.6% respectively (for a total of 100%). Clearly, a cycle of 1 is by far the most common. See Figure 1.

Figure 1

This is not to say that other cycles are not possible but the percentages shown in Figure 1 hold true for the first 26200 numbers. The following SageMath algorithm (permalink) will determine those numbers with a cycle of 3 within a given range. The range and cycle size are easily modified:

L,cycle=[],3
for n in [26100..26200]:
    count,number,M = 0,n,[n]
    for i in [1..7]:
        number=euler_phi(sigma(number))
        if number in M:
            break
        M.append(number)
    for i in range(len(M)):
        if M[i]==number:
            count=len(M)-i
    if count==cycle:
        L.append(n)
print(L)

[26118, 26120, 26140, 26166]

Saturday, 26 September 2020

RATS Sequence

Today I turned 26109 days old and one of the properties of this number is that its a member of OEIS A114613:


A114613

Starting numbers for which the RATS sequence has eventual period 3.



The comments in the OEIS entry offered no explanation but there was a link to Eric Weisstein's World of Mathematics, RATS Sequence

A sequence produced by the instructions "reverse, add to the original, then sort the digits." For example, after 668, the next iteration is given by

668+866=1534

so the next term is 1345.

Applied to 1, the sequence gives: 

1, 2, 4, 8, 16, 77, 145, 668, 1345, 6677, 13444, 55778, 133345, 666677, 1333444, 5567777, 12333445, 66666677, 133333444, 556667777, 1233334444, 5566667777, 12333334444, 55666667777, 123333334444, 556666667777, 1233333334444, ... (OEIS A004000).

Conway conjectured that an initial number leads to a divergent period-two pattern (such as the above in which the numbers of threes and sixes in the middles of alternate terms steadily increase) or to a cycle (Guy 2004, p. 404).

The lengths of the cycles obtained by starting with \(n\)= 1, 2, ... are 0, 0, 8, 0, 0, 8, 0, 0, 2, 0, ... (OEIS A114611), where a 0 indicates that the sequence diverges.

The following table summarizes the first few values of \(n\) leading to a period of length \(k\). There are no other periods of length 50 or less for \(n \leq 5 \times 10^7\).

 (E. W. Weisstein, Dec. 19, 2005). 

\(k\)OEIS\(n\) with period \(k\)
A001651  1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, ...
2A1146129, 18, 27, 36, 45, 54, 63, 69, 72, 78, 81, 87, 90, 96, ...
3A11461320169, 20709, 21159, 22149, 23139, 24129, 25119, 26109, ...
8A1146143, 6, 12, 15, 21, 24, 30, 33, 39, 42, 48, 51, 57, 60, 66, ...
14A1146156999, 7089, 7179, 7269, 7359, 7449, 7539, 7629, ...
18A11461629, 38, 47, 49, 56, 58, 65, 67, 74, 76, 83, 85, 92, 94, ...

In the case of 26109, it can seen from the following SageMath code that the instructions do indeed lead to a period with length 3 (permalink):

number=26109
L=[number]
while len(L)==Set(L).cardinality():
    N=number.digits()
    reversal=0
    for n in range(0, len(N)):
        reversal+=N[n]*10^(len(N)-n-1)
    number=number+reversal
    D=sorted(number.digits())
    index, number=0,0
    for d in D:
        number+=d*10^(len(D)-index-1)
        index+=1
    L.append(number)
print(L)

[26109, 111267, 337788, 1122255, 4446666, 1111113, 2222244, 4446666]

Here is a little more background surrounding this sequence, taken from this site:

Princeton mathematician John Horton Conway calls this the RATS sequence (for “reverse, add, then sort”) and in 1989 conjectured that no matter what number you start with (in base 10), you’ll either enter the divergent pattern above or find yourself in some cycle. Conway’s colleague at Princeton, Curt McMullen, showed that the conjecture is true for all numbers less than a hundred million, and himself conjectured that every RATS sequence in bases smaller than 10 is eventually periodic. Are they right? So far neither conjecture has been disproved. 

There seems to be however, another version of the RATS sequence with members generated using the following rule:

Write down an integer. Remove any zeros and sort the digits in increasing order. Now add this number to its reversal to produce a new number, and perform the same operations on that and so on. Source.

Applying this to 26109, we see that it does produce a loop but its period is 2 (1170 --> 828 --> 1170) not 3 (4446666 --> 1111113 --> 2222244 --> 4446666) as was the case with our original steps:

26109 —> 2619 —> 1269 —> 1269 + 9621 —> 10890

10890 —> 189 —> 189 + 981 —> 1170

1170 —> 117 —> 117 + 711 —> 828

828 —> 288 —> 288 + 882 —> 1170 

 The original instructions are more straightforward and don't require removal of any zeroes.