Showing posts with label absolute value. Show all posts
Showing posts with label absolute value. Show all posts

Friday, 11 September 2026

Variations on Magnanimous Numbers

Today I'm 28285 days old and one of the properties of this number is that it's magnanimous, meaning that inserting a "+" between any two digits produces a prime. In this case we have:

  • 2+8285 = 8287 is prime

  • 28+285 = 313 is prime

  • 282+85 = 367 is prime

  • 2828+5 = 2833 is prime
I review these sorts of numbers in my post titled Magnanimous Numbers from December of 2020. This got me thinking about subtraction instead of addition or to put it formally and applying the absolute value operator:

| Minuend - Subtrahend | = | Difference |

Take as an example, the number 28041 where we have:
  • | 2 - 8041 | = 8039 is prime

  • | 28 - 41 | = 13 is prime

  • | 280 - 41 | = 239 is prime

  • | 2804 - 1 | = 2803 is prime
Here is the full list of 230 such numbers up to 40000 (permalink):

13, 14, 16, 18, 20, 24, 25, 27, 29, 30, 31, 35, 36, 38, 41, 42, 46, 47, 49, 50, 52, 53, 57, 58, 61, 63, 64, 68, 69, 70, 72, 74, 75, 79, 81, 83, 85, 86, 92, 94, 96, 97, 103, 108, 114, 118, 130, 132, 138, 154, 174, 190, 198, 207, 209, 225, 245, 263, 269, 285, 301, 310, 332, 334, 356, 370, 376, 392, 409, 421, 441, 447, 463, 465, 487, 503, 507, 518, 536, 552, 558, 601, 623, 629, 643, 665, 667, 689, 709, 710, 714, 730, 736, 754, 774, 790, 796, 801, 845, 867, 907, 912, 956, 970, 992, 1003, 1114, 1152, 1158, 1332, 1354, 1510, 1614, 1758, 1930, 1992, 1998, 2007, 2009, 2025, 2241, 2421, 2465, 2603, 2609, 2663, 2685, 2729, 2825, 2841, 2865, 3154, 3310, 3370, 3376, 3392, 3436, 3512, 3596, 3634, 3730, 3790, 3956, 3970, 4021, 4047, 4087, 4201, 4245, 4341, 4401, 4467, 4603, 4663, 4665, 4687, 4801, 4867, 5052, 5156, 5514, 5592, 5658, 5952, 5996, 6001, 6023, 6029, 6043, 6065, 6067, 6089, 6163, 6203, 6245, 6269, 6365, 6563, 6607, 6623, 6689, 6863, 7009, 7134, 7270, 7314, 7390, 7396, 7570, 7734, 7936, 8069, 8241, 8265, 8285, 8607, 8625, 8667, 8669, 8847, 8865, 8885, 9092, 9290, 9356, 9736, 9896, 9976, 9992, 10003, 11532, 11598, 11952, 15154, 17574, 20007, 20063, 20841, 22041, 22401, 24029, 24203, 24263, 24623, 26009, 26265, 27029, 28041, 33190, 37396

With multiplication we would need to add 1 or subtract 1. Let's take 28034 as an example of the former where we have:
  • 2 x 8034 + 1 = 16069 is prime

  • 28 x 34 + 1 = 953 is prime

  • 280 x 34 + 1 = 9521 is prime

  • 2803 x 4 + 1 = 11213 is prime
The 421 numbers that satisfy in the range up to 40000 are (permalink):

11, 12, 14, 16, 21, 22, 23, 25, 26, 28, 29, 32, 34, 36, 41, 43, 44, 47, 49, 52, 56, 58, 61, 62, 63, 65, 66, 67, 74, 76, 82, 85, 89, 92, 94, 98, 101, 104, 106, 112, 116, 118, 128, 136, 142, 152, 166, 178, 182, 202, 203, 205, 209, 221, 223, 229, 236, 244, 248, 254, 256, 263, 265, 274, 281, 298, 302, 306, 326, 332, 336, 352, 374, 376, 392, 394, 401, 407, 425, 428, 434, 448, 449, 484, 487, 502, 508, 512, 526, 542, 548, 556, 562, 566, 584, 586, 601, 603, 607, 616, 625, 626, 632, 647, 652, 658, 661, 663, 666, 704, 706, 718, 728, 734, 748, 766, 778, 794, 805, 812, 829, 832, 844, 865, 874, 884, 902, 934, 958, 968, 982, 992, 1001, 1004, 1006, 1018, 1052, 1106, 1108, 1156, 1162, 1178, 1192, 1226, 1228, 1256, 1312, 1352, 1448, 1498, 1568, 1616, 1658, 1708, 1726, 1756, 1862, 1886, 1982, 2002, 2003, 2009, 2023, 2026, 2065, 2074, 2086, 2176, 2204, 2216, 2221, 2228, 2243, 2281, 2306, 2336, 2384, 2386, 2443, 2524, 2576, 2645, 2648, 2686, 2716, 2774, 2776, 2849, 2876, 2998, 3002, 3006, 3034, 3074, 3136, 3152, 3224, 3244, 3302, 3404, 3412, 3526, 3542, 3566, 3574, 3592, 3704, 3734, 3932, 4001, 4007, 4034, 4043, 4078, 4102, 4142, 4168, 4234, 4265, 4274, 4304, 4402, 4423, 4447, 4504, 4685, 4724, 4807, 4825, 4918, 4982, 5008, 5036, 5066, 5162, 5198, 5206, 5302, 5344, 5366, 5506, 5518, 5534, 5542, 5558, 5594, 5608, 5612, 5708, 5726, 5786, 5918, 6001, 6003, 6007, 6056, 6076, 6112, 6166, 6178, 6182, 6245, 6263, 6268, 6382, 6412, 6443, 6452, 6467, 6518, 6536, 6601, 6605, 6607, 6632, 6667, 6766, 6802, 6902, 7004, 7006, 7094, 7118, 7126, 7244, 7384, 7424, 7516, 7606, 7706, 7886, 7918, 7948, 8005, 8042, 8056, 8186, 8201, 8249, 8261, 8266, 8324, 8332, 8462, 8474, 8516, 8536, 8542, 8602, 8662, 8794, 8912, 8942, 8984, 9002, 9034, 9112, 9128, 9158, 9254, 9278, 9428, 9494, 9502, 9532, 9652, 9704, 9748, 9932, 9992, 10004, 10018, 10028, 10136, 10312, 10336, 10448, 11102, 11276, 11482, 11552, 11578, 11608, 11662, 12026, 12206, 12656, 12728, 13256, 13312, 14002, 14098, 14158, 14548, 14758, 14798, 14812, 14968, 15208, 15856, 15952, 16142, 17126, 18116, 18536, 18736, 18962, 19012, 19402, 19768, 19832, 20002, 20021, 20254, 20849, 20866, 21778, 22178, 22616, 22778, 22948, 23834, 23876, 24043, 24118, 24334, 24424, 24824, 25228, 25298, 25366, 25556, 25844, 26005, 26516, 26665, 27028, 27356, 27784, 28034, 28516, 28874, 29708, 30274, 30362, 30662, 30704, 32024, 32066, 32234, 33106, 33182, 33784, 34492, 35206, 36676, 38032, 38362, 38512, 38734, 39532

If instead we subtract 1, we get the following 400 numbers in the range up to 40000 (permalink):

13, 14, 16, 18, 22, 23, 24, 26, 27, 29, 31, 32, 34, 36, 38, 41, 42, 43, 45, 46, 48, 54, 56, 61, 62, 63, 64, 65, 67, 68, 69, 72, 76, 81, 83, 84, 86, 89, 92, 96, 98, 103, 106, 108, 114, 124, 138, 154, 162, 168, 174, 184, 198, 203, 204, 207, 209, 212, 222, 236, 242, 264, 269, 296, 301, 302, 306, 308, 324, 334, 336, 338, 384, 386, 398, 402, 405, 406, 421, 426, 427, 441, 456, 463, 468, 492, 496, 504, 512, 522, 536, 548, 572, 588, 596, 601, 603, 604, 607, 608, 618, 629, 638, 642, 643, 664, 667, 684, 702, 706, 714, 726, 762, 784, 786, 792, 801, 803, 806, 809, 825, 834, 845, 846, 863, 876, 902, 908, 912, 948, 956, 962, 972, 986, 992, 996, 1006, 1038, 1062, 1084, 1104, 1152, 1308, 1314, 1368, 1422, 1504, 1524, 1548, 1608, 1614, 1654, 1662, 1692, 1734, 1752, 1824, 1854, 1864, 1884, 1968, 1992, 2003, 2007, 2012, 2036, 2052, 2064, 2112, 2274, 2427, 2465, 2486, 2609, 2612, 2664, 2724, 2736, 2805, 3002, 3008, 3086, 3198, 3234, 3304, 3318, 3368, 3408, 3498, 3504, 3596, 3624, 3634, 3638, 3668, 3786, 3926, 3976, 4005, 4006, 4021, 4026, 4083, 4152, 4158, 4188, 4207, 4221, 4246, 4272, 4306, 4326, 4396, 4407, 4458, 4692, 4801, 4818, 4843, 4906, 4962, 4992, 5004, 5102, 5148, 5168, 5172, 5202, 5214, 5334, 5376, 5418, 5462, 5492, 5538, 5604, 5622, 5756, 5784, 6001, 6004, 6008, 6012, 6043, 6045, 6067, 6098, 6264, 6308, 6334, 6368, 6402, 6465, 6542, 6603, 6665, 6714, 6754, 6774, 6834, 6858, 6912, 6998, 7002, 7152, 7242, 7422, 7452, 7476, 7546, 7554, 7564, 7806, 7876, 7896, 7926, 7996, 8003, 8006, 8063, 8154, 8184, 8198, 8289, 8445, 8483, 8598, 8685, 8784, 8948, 9296, 9542, 9672, 9756, 9806, 9836, 9902, 9972, 9976, 10014, 10024, 10062, 10234, 10422, 10548, 10662, 11088, 11118, 11202, 12004, 12504, 12522, 12634, 13308, 13638, 14022, 14448, 14592, 14958, 15114, 15438, 15504, 15648, 15684, 16008, 16038, 16654, 16962, 17742, 18054, 18468, 19398, 20007, 20012, 20112, 20154, 20205, 20289, 20427, 20724, 20784, 21102, 21212, 21272, 21774, 21792, 21962, 22014, 22122, 22164, 22212, 22242, 22401, 22605, 22821, 22824, 22962, 23486, 24086, 24602, 25122, 25386, 26004, 26412, 26574, 26669, 27036, 27252, 27542, 27756, 27912, 28056, 28284, 28896, 29072, 29292, 29402, 29702, 30086, 30098, 30604, 30848, 31234, 32004, 32514, 33336, 33354, 33368, 33726, 34908, 35706, 36124, 36168, 37134, 37204, 37356, 38036, 38184, 39006, 39048

Let's take the last member, 39048, as an example:
  • 3 x 9048 - 1 = 27143 is prime

  • 39 x 48 - 1 = 1871 is prime

  • 390 x 48 - 1 = 18719 is prime

  • 3904 x 8 - 1 = 31231 is prime

Thursday, 25 June 2026

Reverse Engineering Part 2

In my previous post Reverse Engineering Part 1, I had specified to Gemini that I wanted \(p + q + r \) to be the minimum possible within the specifications that each of these coefficients were to be between -9 and -9 inclusive. I was thinking in terms of the sum getting as close to zero as possible forgetting that the minimum possible sum would be -27. That's why I was getting coefficients in the output that were all negative. The algorithm was doing what I'd asked of it! What I should have instructed Gemini to do was to take the absolute value of \(p+q+r\). So to summarise, our starting point is:$$ \begin{align} &\text{a}(n)=p \times \text{a}(n-1)+q \times \text{a}(n-2) + r \times \text{a}(n-2)\\ &\text{with } -9 \leq p,q,r \leq 9, 0 \leq \text{a}(2), \text{a}(1),\text{a}(0) \leq 9 \\ &\text{and } |p+q+r| \text{ as close to zero as possible} \end{align}$$Having gotten Gemini to modify the algorithm, the result for 28206 becomes :$$ \begin{align} &\text{a}(n)=5 \times \text{a}(n-1)-7 \times \text{a}(n-2) + 2 \times \text{a}(n-2)\\ &a(0) = 2, a(1) = 2, a(2) = 6\end{align}$$The full details are (permalink):

Target Number: 28206
------------------------------
Constants found: p = 5, q = -7, r = 2
Constraint check: Minimum |p + q + r| = 0 (Actual Sum = 0)
Seed numbers:    a(0) = 2, a(1) = 2, a(2) = 6
------------------------------
Sequence progression:
  a(0) = 2
  a(1) = 2
  a(2) = 6
  a(3) = 20
  a(4) = 62
  a(5) = 182
  a(6) = 516
  a(7) = 1430
  a(8) = 3902
  a(9) = 10532
  a(10) = 28206
------------------------------
Comma-separated sequence:
2, 2, 6, 20, 62, 182, 516, 1430, 3902, 10532, 28206

This is a longer sequence than previously (2, 4, 2, -48, 408, -3390, 28206) but it has no negative members and is free of the wild gyrations that characterise the former. Similarly for 28207, we have (permalink):$$ \begin{align} &\text{a}(n)=5 \times \text{a}(n-1)+4 \times \text{a}(n-2) -8 \times \text{a}(n-2)\\ &a(0) = 1, a(1) = 1, a(2) = 7\end{align}$$The full results are (permalink):

Target Number: 28207
------------------------------
Constants found: p = 5, q = 4, r = -8
Constraint check: Minimum |p + q + r| = 1 (Actual Sum = 1)
Seed numbers:    a(0) = 1, a(1) = 1, a(2) = 7
------------------------------
Sequence progression:
  a(0) = 1
  a(1) = 1
  a(2) = 7
  a(3) = 31
  a(4) = 175
  a(5) = 943
  a(6) = 5167
  a(7) = 28207
------------------------------
Comma-separated sequence:
1, 1, 7, 31, 175, 943, 5167, 28207

This is shorter than the previously calculated sequence (3, 5, 1, -73, 243, -323, -311, 2207, -3445, -3595, 27729, -51001, -16797, 304365, -658279, 28207) and again it has no negative members and is free of the wild gyrations that characterise the former. So, a lesson learned. I've modified my daily number analysis algorithm accordingly. 

Sunday, 29 September 2024

Palindromic Day 27572

Every 100 days another palindrome day rolls by and yesterday I celebrated palindromic day 27572. Now this palindrome has an arithmetic digital root that is equal to its central digit of 5. This is because:$$ 27572 \rightarrow 2+7+5+7+2= 23 \rightarrow 2 + 3 =5 $$However, the absolute difference between the first two digits (and of course the last two digits as well) is also equal to the digital root and the central digit.

| 2 - 7 | = 5 = | 7 - 2 |

This makes the palindrome extra special and in the range of five digit numbers from 10000 to 99999 only the following palindromes have the properties previously mentioned. These are (permalink):


18781, 27572, 36363, 45154, 54145, 63336, 72527, 81718, 90909

If we allowed leading zeros then we would have:

  • 09990 has the same digits as 90909
| 0 - 9 | = 9 = | 9 - 0 |
  • 18781 has the same digits as 81718
| 1 - 8 | = 7 = | 8 - 1 |
  • 27572 has the same digits as 72527
| 2 - 7 | = 5 = | 7 - 2 |
  • 36363 has the same digits as 63336
| 3 - 6 | = 3 = | 6 - 3 |
  • 45154 has the same digits as 54145
| 4 - 5 | = 1 = | 5 - 4 |

Remember that the central digit is also the arithmetic digital root of the number.

Wednesday, 7 August 2024

Subtractive Fibonacci-like Numbers

Consider all two digit numbers from 10 to 99 and use these as the seed digits that will generate a third number NOT by ADDITION of the two digits but by SUBTRACTION, subtracting the smaller digit from the larger when they are different. This ensures that the result is always positive or zero. Taking the absolute value of the result is another way to regard it. Here are the 90 numbers.

10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99

These 90 two digit numbers will generate another 90 three digit numbers. These are:

101, 110, 121, 132, 143, 154, 165, 176, 187, 198, 202, 211, 220, 231, 242, 253, 264, 275, 286, 297, 303, 312, 321, 330, 341, 352, 363, 374, 385, 396, 404, 413, 422, 431, 440, 451, 462, 473, 484, 495, 505, 514, 523, 532, 541, 550, 561, 572, 583, 594, 606, 615, 624, 633, 642, 651, 660, 671, 682, 693, 707, 716, 725, 734, 743, 752, 761, 770, 781, 792, 808, 817, 826, 835, 844, 853, 862, 871, 880, 891, 909, 918, 927, 936, 945, 954, 963, 972, 981, 990

These in turn will spawn another 90 numbers. These are:

1011, 1101, 1211, 1321, 1431, 1541, 1651, 1761, 1871, 1981, 2022, 2110, 2202, 2312, 2422, 2532, 2642, 2752, 2862, 2972, 3033, 3121, 3211, 3303, 3413, 3523, 3633, 3743, 3853, 3963, 4044, 4132, 4220, 4312, 4404, 4514, 4624, 4734, 4844, 4954, 5055, 5143, 5231, 5321, 5413, 5505, 5615, 5725, 5835, 5945, 6066, 6154, 6242, 6330, 6422, 6514, 6606, 6716, 6826, 6936, 7077, 7165, 7253, 7341, 7431, 7523, 7615, 7707, 7817, 7927, 8088, 8176, 8264, 8352, 8440, 8532, 8624, 8716, 8808, 8918, 9099, 9187, 9275, 9363, 9451, 9541, 9633, 9725, 9817, 9909

These in turn will spawn another 90 numbers. These are:

10110, 11011, 12110, 13211, 14312, 15413, 16514, 17615, 18716, 19817, 20220, 21101, 22022, 23121, 24220, 25321, 26422, 27523, 28624, 29725, 30330, 31211, 32110, 33033, 34132, 35231, 36330, 37431, 38532, 39633, 40440, 41321, 42202, 43121, 44044, 45143, 46242, 47341, 48440, 49541, 50550, 51431, 52312, 53211, 54132, 55055, 56154, 57253, 58352, 59451, 60660, 61541, 62422, 63303, 64220, 65143, 66066, 67165, 68264, 69363, 70770, 71651, 72532, 73413, 74312, 75231, 76154, 77077, 78176, 79275, 80880, 81761, 82642, 83523, 84404, 85321, 86242, 87165, 88088, 89187, 90990, 91871, 92752, 93633, 94514, 95413, 96330, 97253, 98176, 99099

Let's forget about our two digit starting numbers and consider only the resulting three, four and five digit numbers. Grouping them all together we have the following 270 member sequence:

101, 110, 121, 132, 143, 154, 165, 176, 187, 198, 202, 211, 220, 231, 242, 253, 264, 275, 286, 297, 303, 312, 321, 330, 341, 352, 363, 374, 385, 396, 404, 413, 422, 431, 440, 451, 462, 473, 484, 495, 505, 514, 523, 532, 541, 550, 561, 572, 583, 594, 606, 615, 624, 633, 642, 651, 660, 671, 682, 693, 707, 716, 725, 734, 743, 752, 761, 770, 781, 792, 808, 817, 826, 835, 844, 853, 862, 871, 880, 891, 909, 918, 927, 936, 945, 954, 963, 972, 981, 990, 1011, 1101, 1211, 1321, 1431, 1541, 1651, 1761, 1871, 1981, 2022, 2110, 2202, 2312, 2422, 2532, 2642, 2752, 2862, 2972, 3033, 3121, 3211, 3303, 3413, 3523, 3633, 3743, 3853, 3963, 4044, 4132, 4220, 4312, 4404, 4514, 4624, 4734, 4844, 4954, 5055, 5143, 5231, 5321, 5413, 5505, 5615, 5725, 5835, 5945, 6066, 6154, 6242, 6330, 6422, 6514, 6606, 6716, 6826, 6936, 7077, 7165, 7253, 7341, 7431, 7523, 7615, 7707, 7817, 7927, 8088, 8176, 8264, 8352, 8440, 8532, 8624, 8716, 8808, 8918, 9099, 9187, 9275, 9363, 9451, 9541, 9633, 9725, 9817, 9909, 10110, 11011, 12110, 13211, 14312, 15413, 16514, 17615, 18716, 19817, 20220, 21101, 22022, 23121, 24220, 25321, 26422, 27523, 28624, 29725, 30330, 31211, 32110, 33033, 34132, 35231, 36330, 37431, 38532, 39633, 40440, 41321, 42202, 43121, 44044, 45143, 46242, 47341, 48440, 49541, 50550, 51431, 52312, 53211, 54132, 55055, 56154, 57253, 58352, 59451, 60660, 61541, 62422, 63303, 64220, 65143, 66066, 67165, 68264, 69363, 70770, 71651, 72532, 73413, 74312, 75231, 76154, 77077, 78176, 79275, 80880, 81761, 82642, 83523, 84404, 85321, 86242, 87165, 88088, 89187, 90990, 91871, 92752, 93633, 94514, 95413, 96330, 97253, 98176, 99099

The sequence will continue indefinitely and what drew my attention to these types of numbers was the number associated with my diurnal age today, 27520. I noticed that it almost qualified because 7 - 2 = 5, 7 - 5 = 2 but 5 - 2 does not produce the required final digit of 3. However, in three more days it will when my diurnal age reaches 27523 days. The next number in the sequence is 28624 which is some three years away. Such numbers are certainly not frequent so they deserve to be given some attention.

Viewed as a Fibonacci-like sequence of numbers, the sequences all settle down to a repetitive \(0, n, n\) pattern where \(n\) is a digit between 1 and 9. For example, 27523 becomes:$$2, 7, 5, 2, 3, 1, 2, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, \dots$$The fact that the absolute value of the repeated subtraction of the two digits cannot produce numbers greater than 9 ensures eventual repetition. Subtraction aside, there are similar sequences to explore like adding the first two digits together to produce a third number that is not the sum of the first two, as in the Fibonacci sequence, but the DIGITAL ROOT of the number. For example:$$ \begin{align} 27 &\rightarrow 279 \\279 &\rightarrow 2797 \text{ since } 9 + 7 = 16 \rightarrow 7 \\ 2797 &\rightarrow 27977 \end{align} $$This sequence will be examined in my next post.

Thursday, 18 July 2024

Area of Triangle Using Matrices and Determinants

I watched an interesting YouTube video explaining how to use matrices and determinants to find the area of a triangle given its vertices. Of course, one could use the distance formula to find the lengths of the sides and then use Heron's formula to find the area but this method is far quicker as we'll see.

The first example used in the video involved the points (1,1), (4,1) and (4,5). These coordinates are used to form a 3 x 3 matrix with the x coordinates forming the first column, the y coordinates forming the second column, and the third column consisting of three 1's. The result is as shown below:$$ \begin{bmatrix} 1 & 1 & 1 \\ 4 & 1 & 1\\ 4 & 5 & 1 \end{bmatrix} $$The determinant of this matrix is 12 and the area of the triangle is simply half the value of the determinant, namely 6. The coordinates were chosen by the author of the video so that the the triangle formed by the vertices is right-angled and its area quickly calculated. See Figure 1.


Figure 1: f = 3 units and g = 4 units
and so area is  3 x 4 / 2 = 6 square units

Here is a permalink to a SageMath algorithm that will calculate the area form the coordinates of the input vertices. The second example in the video involved the vertices (2, 3), (5, 7) and (10, -5). This produces the following matrix:
$$ \begin{bmatrix} 2 & 3 & 1 \\ 5 & 7 & 1\\ 10 & -5 & 1 \end{bmatrix} $$This matrix has a determinant of -56 and we take half of its absolute value to calculate the area of the triangle to be 28 square units. See Figure 2.


Figure 2

The video goes through the process of finding the lengths of f, g and h using the Pythagorean theorem and then using Heron's formula to find the area. This is done to confirm that matrix/determinant method actually works so I won't reproduce that here. Suffice to say that once the matrix M is constructed, we can say that:$$\text{Area of Triangle }=\frac{1}{2} \times \text{ det } |M|$$This got me thinking about quadrilaterals and whether this method could be extended to find the area of quadrilaterals but it doesn't appear to. The quadrilateral would need to be broken up into two triangles and the area of each calculated using the matrix/determinant method.

Saturday, 30 March 2024

Very Special Five Digit Numbers

Analysing the number associated with my diurnal age means that since I turned 10000 days old, those numbers have always contained five digits and will continue to do so for the remainder of my life. Today I turned 27391 days old and that number has a very special quality.


What's obvious at first glance is that all the digits are distinct but less obvious is the fact the absolute values of the differences between successive pairs of digits, which are digits themselves, are also distinct and are different to the digits of the number. As there are four such differences between the five digits of the number, this means that all the digits from 1 to 9 make an appearance.$$ \underbrace{|2-7|}_{5} \, \underbrace{|7-3|}_{4} \, \underbrace{|3-9|}_{6} \, \underbrace{|9-1|}_{8}$$Numbers of this sort belong to OEIS A365257:


 A365257

The five digits of a(\(n\)) and their four successive absolute first differences are all distinct.


The OEIS comments state that:
The digit 0 is never present in a(\(n\)) and never appears as a first difference (as this would duplicate in both cases one of the 8 remaining digits involved).

The sequence ends with a(96) = 98274.

The only prime numbers with this property are 39157, 49681, 51869, 53719, 62983, 68749, 68947, 75193, 78259, 89627 and 95287.

The 96 members of this sequence are:

14928, 15829, 17958, 18259, 18694, 18695, 19372, 19375, 19627, 25917, 27391, 27398, 28149, 28749, 28947, 34928, 35917, 37289, 37916, 38926, 39157, 39578, 43829, 45829, 47289, 47916, 49318, 49681, 49687, 51869, 53719, 57391, 57398, 58926, 59318, 59681, 59687, 61973, 61974, 62983, 62985, 67958, 68149, 68749, 68947, 69157, 69578, 71952, 71953, 72691, 72698, 74619, 74982, 74986, 75193, 75196, 76859, 78259, 78694, 78695, 81394, 81395, 81539, 82941, 82943, 85179, 85629, 85971, 85976, 86749, 87269, 87593, 87596, 89372, 89375, 89627, 91647, 91735, 92658, 92834, 92851, 92854, 93518, 94182, 94186, 94768, 94782, 94786, 95281, 95287, 95867, 96278, 96815, 97158, 98273, 98274

As can be seen, I'm due to experience another such number in a week from today when I reach 27398 days old. My forthcoming 75th birthday, when I am 27394 days old, thus falls between these two special five digit numbers. 

Tuesday, 6 June 2023

Two Mystery Sequences

What if you were presented with the following sequence of terms:

9, 18, 27, 36, 45, 54, 63, 72, 99, 198, 297, 396, 495, 594, 693, 792, 999, 1998, 2997, 3996, 4995, 5994, 6993, 7992, 8082, 8172, 8262, 8352, 8442, 8532, 8622, 8712, 8802, 9999, 19998, 29997, 39996, 49995, 59994, 69993, 79992, 80982, 81972, 82962, 83952, 84942, 85932, 86922, 87912, 88902, 99999, 199998, 299997, 399996, 499995, 599994, 699993, 799992, 809982, 819972, 829962, 839952, 849942, 859932, 869922, 879912, 889902, 890802, 891702, 892602, 893502, 894402, 895302, 896202, 897102, 898002 

What is the pattern that this sequence is following? At first it looks like we are just generating multiples of 9 because we begin with 9, 18, 27, 36, 45, 54, 63, 72 but after that 99 follows and not 81. However, 99 is followed by its multiples again up to 792 = 8 x 99 after which there is a jump to 999 and the pattern repeats. The jump from the 8th multiple is always to the largest number with the same number of digits as the previous multiples. Thus from 72 we jump to 99 and from 792 we jump to 999. However, 999 then progresses to its 17th multiple, not its 8th, and then jumps to 9999 which then repeats this pattern. 

We could keep making up ad hoc rules to account for the terms of this sequence but actually they arise from a fairly simple process: 

  • start with the number 1
  • take this number, reverse it and calculate the absolute difference between the two numbers
  • if this difference is greater than zero and greater than any previous difference, then add this difference as a term of the sequence
  • proceed to the next number
All single digit numbers and even 11, because it is a palindrome, will yield a difference of zero and so no terms are added. However, once we reach 12, its reversal is 21 and the difference is 9 and so this becomes the first term of the sequence. The next number is 13 and the difference with its reversal of 31 is 18, so this difference is added to the sequence and so on. Table 1 shows the situation with the fourth column showing the factorisation of all the record differences in the range up to 100,000:


Table 1: permalink

The only such number that I'm likely to experience, via my diurnal age, is 29997. Not surprisingly, the OEIS does not recognise this sequence and I've no intention of attempting to add it.

Another interesting sequence arises if we look at the prime factors of these differences. In the first one million numbers, the prime factors that arise are as follows (arranged in ascending order and ignoring multiplicity):

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 53, 67, 79, 101, 163, 227, 271, 307, 337, 409, 419, 439, 449, 479, 941, 1559, 2053, 2647, 2917, 3803, 5521, 7127, 22777, 23887, 49639, 49739, 49789

Again, the OEIS has nothing to say about this sequence and it would be difficult to reverse engineer this sequence. What pattern does it follow? At first it seems like the sequence of prime numbers, until we get to 41. After this, 43 and 47 are skipped and then 53 is added. Why? Anyway, nothing too profound here, just two seemingly mysterious sequences that arise from a simple process operating in the background.

Sunday, 29 March 2020

Sum Product Numbers and Near Misses

A sum-product number is a number \(n\) such that the sum of its digits times the product of its digit is \(n\) itself. For example:$$135=(1+3+5)\times (1 \times 3 \times 5)$$There are only three sum-product numbers: 1, 135, and 144 (OEIS A038369), although 0 of course could be included if desired.


  A038369

Numbers n such that n = (product of digits of n) * (sum of digits of n).   


Of interest also are numbers such that the sum of their digits times the product of their digit differ from by 1, 2, 3, … The table in Figure 1 shows these initial numbers (source):

Figure 1

The code to determine these initial numbers is shown in Figure 2 with a difference of 6 being used as the example:

Figure 2: permalink

Of course, if the number base is changed (say to 16), an entirely different set of numbers is obtained. In base 16 and with a number difference of 6, the set consists of 3, 482, 554, 582, 7494, 12954. In the case of 12954, it becomes 329A and so the sum of its digits is 3 + 2 + 9 + 10 = 24 and the product of its digits is 3 x 2 x 9 x 10 = 540. The product of 24 and 540 is 12960 which does indeed differ from 12954 by 6. See Figure 3.

Figure 3: permalink

These numbers, in base 10 or any other base, are curiosities and probably, like selfie numbers, not of any deep mathematical significance. However, I did turn 25926 days old recently (March 27th 2020) and that's when I stumbled upon the number thanks to a Wolfram MathWorld link. It features in the set of numbers shown in Figure 2 and it also appears in the table in Figure 1.