Showing posts with label composite. Show all posts
Showing posts with label composite. Show all posts

Friday, 9 October 2026

23 Revisited

The number 23 never ceases to be of interest. Back in November of 2020 I made a post titled Twenty Three in which I looked at some of the properties of this prime number. These included the following:

  • 23 and 239 are the only integers requiring nine positive cubes for their representation
  • 23 has a reciprocal with a period of 22
  • 23 features in and is central to the birthday paradox
  • 23 is a Sophie Germain and safe prime
  • 23 forms part of the first Cunningham chain 2, 5, 11, 23, 47
  • 23 is the smallest odd prime that is not a twin prime
  • 23 is the second Woodell prime (the first is 7)
  • 23 is a factorial prime equal to 4! -1
  • 23 is the second Smarandache–Wellin prime (the first is 2)
  • 23 divides 874, the sum of the first 23 primes
  • 23 is the length of the repunit prime 11111111111111111111111
  • 23 is the only prime \(p\) such that \(p!\) is \(p\) digits long
  • 23 is conjectured to be the only pointer prime that does not contain a 1
The number associated with my diurnal age today, 28313, caught my attention because the number 23 stood out:$$ \textcolor{red}{2}8\textcolor{red}{3}13 = \textcolor{red}{23} \times 1\textcolor{red}{23}1 $$I wondered how common this sort of pattern was so I asked Gemini to write a program to find out. This was the prompt:
Write a program in SageMath that determines all the composite, positive integers in a given range that contain the digits 2 and 3 in ascending order from left to right (but not necessarily consecutively) and whose prime factors also all contain the digits 2 and 3 in ascending order but not necessarily consecutively. The default range can be from 1 to 40000. The output should a table showing number and factors followed by a comma-separated list of the qualifying numbers.

Here is a permalink to the program that returned only one result: 28313. Extending the range to 100,000 gives us the following numbers:

Number     | Prime Factors
--------------------------------------------------
28313      | 23, 1231
52739      | 23, 2293
58213      | 23, 2531
62399      | 23, 2713
62813      | 23, 2731

It is only when we extend the range to one million that we find numbers such that the 23's  are all formed from consecutive digits. I modified the prompt and got Gemini to create a new program:
Write a program in SageMath that determines all the composite, positive integers in a given range that contain the digits 2 and 3 consecutively in ascending order from left to right and whose prime factors also all contain the digits 2 and 3 consecutively in ascending order. The default range can be from 1 to one million. The output should be a table showing number and factors followed by a comma-separated list of the qualifying numbers (permalink).

Here are the results when the program is run: 

123257, 235129, 282923, 286823, 442313, 523381, 533623, 542363, 547423, 552329, 555239, 563323, 672313, 902359, 985823

Number       | Prime Factors
--------------------------------------------------
123257       | 23, 233
235129       | 23, 10223
282923       | 23, 12301
286823       | 233, 1231
442313       | 23, 19231
523381       | 223, 2347
533623       | 23, 23201
542363       | 23, 23581
547423       | 23, 23801
552329       | 239, 2311
555239       | 233, 2383
563323       | 239, 2357
672313       | 23, 29231
902359       | 23, 39233
985823       | 233, 4231

These numbers of course are far beyond what my diurnal age will ever reach but we can identify 29231 as a special number because it contains the digit sequence 23 and when multiplied by 23 produces a new number, 672313, that also contains the digit sequence 23. I may reach this number but it's doubtful whether I'll reach the next (39233) that has the same property. 

Friday, 28 August 2026

Inserting Digits

28269 is a composite number with the interesting property that if we insert the digit 7 in any position, the result is a prime number. Thus 728269, 278269, 287269, 282769, 282679 and 282697 are all prime. Such numbers belong to OEIS A216168 (permalink):


A216168: composite numbers and 1 which yield a prime whenever a 7 is inserted anywhere in them, including at the beginning or end.

Up to 40000, the members of the sequence are:

1, 9, 27, 33, 39, 57, 87, 159, 177, 187, 603, 717, 753, 949, 1257, 1707, 2277, 2367, 4317, 4623, 4779, 4797, 5773, 6757, 6777, 7017, 7471, 7479, 7747, 7797, 7813, 7977, 8797, 9777, 9987, 10777, 11757, 17679, 28269, 28437, 29779, 34177, 34771

There is an associated OEIS sequence for inserting the digit 1. It is OEIS A216165 (permalink):


A216165: composite numbers and 1 which yield a prime whenever a 1 is inserted anywhere in them, including at the beginning or end.

The initial members of this sequence are:

1, 49, 63, 81, 91, 99, 117, 123, 213, 231, 279, 319, 427, 459, 621, 697, 721, 801, 951, 987, 1113, 1131, 1261, 1821, 1939, 2101, 2149, 2211, 2517, 2611, 3151, 3219, 4011, 4411, 4887, 5031, 5361, 6231, 6487, 7011, 7209, 8671, 9141, 9801, 10051, 10161, 10281, 10603, 10921, 11121, 11127, 11211, 11641, 11767, 11791, 11869, 12997, 13111, 13143, 14311, 16911, 17023, 17541, 18081, 18619, 19677, 21039, 21711, 23289, 25197, 29169, 29971, 31111, 34777, 38559

Here is the associated OEIS A216166 sequence for inserting a 3 (permalink).


A216166: composite numbers and 1 which yield a prime whenever a 3 is inserted anywhere in them (including at the beginning or end).

The initial members of this sequence are:

1, 121, 343, 361, 533, 637, 793, 889, 943, 1183, 3013, 3223, 3353, 3403, 3757, 3827, 3893, 4313, 4543, 4963, 8653, 10423, 14257, 20339, 23083, 23419, 30917, 33031, 33101, 33323, 33433, 33701, 33821, 34333, 34393, 35453, 36437, 36533, 39137, 39247

Here is the result for inserting the digit 9. I wasn't able to locate the OEIS sequence (permalink).

91, 209, 539, 749, 923, 931, 1079, 1139, 2717, 2959, 3971, 3979, 4559, 5629, 6401, 6739, 8213, 8491, 8939, 9607, 11089, 11227, 13943, 14269, 14371, 17381, 17689, 24059, 25517, 25937, 25949, 29087, 29197, 29419, 30989, 31691

There are various variations on this theme. Once can look at numbers, both composite and prime, or one can look at only primes. The insertion can be between digits but not at the beginning and end. The insertion can be only at the beginning and end etc. Let's consider one of these: OEIS A216167.


A216167: composite numbers which yield a prime whenever a 5 is inserted anywhere in them, excluding at the end.


Here are the initial members of the sequence:

9, 21, 57, 63, 69, 77, 87, 93, 153, 231, 381, 407, 413, 417, 501, 531, 581, 651, 669, 741, 749, 783, 791, 987, 1241, 1551, 1797, 1971, 2189, 2981, 3381, 3419, 3591, 3951, 4083, 4503, 4833, 4949, 4959, 5049, 5117, 5201, 5229, 5243, 5529, 5547, 5603, 5691, 5697, 50 6957, 7329, 7389, 7557, 8451, 8711, 9561, 9617, 11337, 11631, 13511, 13533, 15153, 17991, 19539, 23553, 25869, 27053, 30093, 31551, 32249, 32951, 36441, 38159

This approach could be extended to biprimes. For example, one could ask what biprimes (or semiprimes) remain biprimes when the digit 1 is inserted anywhere in the number, including its beginning and end? Using Gemini, here are results that were generated:

Biprimes up to 40000 maintaining the property upon digit insertion (permalink):

Digit 0:

None found in this range.

Digit 1:

[34, 55, 77, 85, 87, 111, 119, 121, 141, 219, 415, 417, 514, 537, 591, 689, 713, 717, 718, 731, 781, 835, 841, 921, 1111, 1114, 1138, 1227, 1293, 1357, 1391, 1591, 1643, 1671, 1761, 1851, 1915, 2171, 2181, 2533, 2623, 2631, 3207, 3561, 3579, 3811, 4119, 4171, 4267, 4353, 5223, 5311, 5321, 5353, 6157, 6181, 6429, 6621, 6697, 7087, 7113, 7131, 7251, 7311, 7513, 7531, 7571, 7897, 8201, 8254, 8511, 8659, 9111, 9123, 9167, 9247, 9271, 9487, 9651, 10147, 10217, 10401, 10417, 10699, 10743, 10765, 11013, 11101, 11107, 11391, 11479, 11513, 11787, 11819, 11899, 12219, 12381, 12399, 12709, 12718, 12751, 12773, 14109, 14119, 14527, 14711, 14727, 15261, 15711, 16213, 16251, 16489, 16621, 16751, 16801, 16917, 17151, 17461, 17527, 17601, 17677, 18091, 18519, 18591, 19111, 19117, 19711, 19729, 19741, 19858, 19959, 20311, 21103, 21461, 21829, 22601, 23811, 24159, 24161, 25331, 26283, 26521, 26869, 27087, 27831, 28009, 29487, 30061, 30157, 30499, 31273, 31587, 32521, 32599, 33193, 33953, 34051, 34567, 34663, 35941, 36331, 36631, 37081, 37461, 37891, 38067, 38623, 39478, 39793]

Digit 2:

[6, 26, 62, 206, 302, 1202, 1226, 1262, 2966, 12242, 26762, 32282, 36422]

Digit 3:

[9, 14, 39, 55, 58, 93, 94, 133, 235, 274, 291, 305, 309, 314, 365, 403, 453, 554, 649, 713, 763, 1067, 1133, 1157, 1385, 1589, 1631, 1961, 1969, 2073, 2174, 2231, 2419, 2483, 2723, 2811, 2867, 3035, 3043, 3134, 3239, 3351, 3443, 3455, 3518, 3595, 3974, 3991, 4315, 4387, 4478, 5057, 5249, 5545, 5761, 6071, 6233, 6431, 6731, 6807, 6817, 6893, 6953, 7033, 7067, 7403, 7543, 7903, 8141, 8359, 8438, 8473, 8483, 8495, 8683, 9395, 9713, 9731, 9838, 9943, 10609, 10897, 11107, 11179, 13483, 13531, 13953, 14131, 14473, 14515, 14809, 15163, 15397, 15833, 16049, 16331, 17113, 17281, 17311, 17521, 17767, 18613, 18721, 19331, 19651, 19693, 20191, 20831, 21541, 22121, 22163, 22733, 23107, 23237, 23303, 23503, 23533, 24173, 24283, 24797, 25129, 25843, 26173, 26545, 27389, 27833, 28399, 29903, 30353, 30445, 30779, 30973, 31187, 31309, 31463, 31757, 31861, 32023, 32231, 32293, 32483, 32539, 32723, 32861, 33017, 33134, 33163, 33193, 33238, 33307, 33313, 33314, 33373, 33407, 33443, 33643, 33689, 33833, 33881, 33951, 33953, 33977, 33979, 34003, 34201, 34249, 34633, 34837, 34885, 35063, 35303, 35723, 35887, 36283, 36289, 36893, 37033, 37333, 37351, 37391, 37733, 38057, 38939, 39449, 39497, 39513, 39793]

Digit 4:

[9, 69, 93, 115, 319, 321, 381, 427, 471, 489, 511, 529, 535, 559, 1101, 1383, 1441, 1623, 1909, 2173, 2319, 2361, 2761, 2881, 3409, 3817, 4009, 4141, 4413, 4479, 4749, 5029, 5143, 5299, 5455, 5611, 6249, 6313, 6331, 6423, 6459, 6541, 7063, 7423, 8097, 8403, 8797, 9313, 11029, 11787, 11881, 12063, 13051, 13389, 13449, 13641, 14187, 14473, 14493, 15529, 18247, 21427, 23611, 24643, 25351, 26409, 26457, 26989, 27157, 28761, 30531, 31609, 31987, 34627, 35493, 35713, 36019]

Digit 5:

[15, 35, 51, 65, 155, 219, 299, 411, 515, 545, 554, 713, 755, 771, 818, 893, 905, 965, 993, 1055, 1469, 2651, 3005, 3065, 3953, 4313, 4359, 4811, 5033, 5069, 5123, 5129, 5345, 5429, 5513, 5543, 5585, 5891, 6218, 7053, 8051, 8301, 8553, 8945, 9155, 9543, 10109, 10749, 16535, 16595, 16955, 17529, 17555, 18653, 19451, 21449, 23255, 24263, 25061, 25131, 25293, 25751, 27831, 28529, 30993, 31539, 33551, 33933, 34559, 35411, 35681, 35693, 35921]

Digit 6:

[22, 62, 122, 662, 746, 2066, 17522, 38062]

Digit 7:

[377, 471, 721, 737, 778, 799, 849, 961, 1057, 1267, 1273, 1639, 1651, 1717, 2041, 2257, 2458, 2841, 3099, 3763, 3977, 3981, 4083, 4247, 4281, 4467, 4577, 4757, 5497, 6009, 6087, 6127, 6267, 6297, 6341, 6729, 6787, 7117, 7313, 7739, 7921, 7971, 8063, 8097, 8457, 8749, 8907, 9057, 9313, 9469, 9897, 9899, 10381, 10617, 11013, 11107, 11217, 11283, 12273, 13017, 13749, 14277, 14757, 15529, 16147, 16957, 17071, 17179, 17439, 17503, 17517, 17637, 17701, 17773, 17781, 17809, 18283, 19039, 19857, 21477, 21741, 23731, 24537, 27147, 27433, 27769, 28263, 28999, 29163, 29229, 30007, 30127, 30721, 31753, 31879, 32259, 32937, 33163, 33897, 34467, 35881, 37381, 37803, 37837]

Digit 8:

[15, 69, 95, 119, 213, 341, 843, 1337, 2481, 2831, 3057, 3161, 3489, 3513, 3587, 3849, 4803, 5489, 5663, 6189, 6459, 6893, 7113, 7355, 7379, 7409, 8057, 8141, 8187, 8189, 8279, 8331, 8399, 8567, 8751, 8889, 8981, 9881, 10119, 11009, 11381, 11477, 12171, 12531, 14109, 16721, 17517, 18087, 18227, 18663, 18809, 20669, 20783, 22467, 23597, 26081, 28299, 28511, 28739, 28781, 28887, 29321, 29891, 30209, 32393, 33881, 34409, 36321, 37581, 38217]

Digit 9:

[4, 21, 33, 51, 74, 93, 95, 115, 119, 183, 235, 247, 259, 481, 589, 799, 813, 914, 917, 959, 979, 989, 993, 995, 998, 1067, 1101, 1165, 1174, 1589, 1799, 1829, 1849, 2098, 2249, 2257, 2509, 2654, 2839, 2923, 2977, 3029, 3099, 3421, 3781, 3959, 4097, 4319, 4699, 4859, 4897, 5065, 5137, 5293, 5909, 5993, 6049, 6107, 6898, 7837, 7921, 8314, 8359, 8489, 8593, 8921, 9094, 9299, 9329, 9335, 9353, 9509, 9569, 9599, 9691, 9763, 9865, 9959, 9977, 10189, 10489, 10511, 10999, 12139, 12199, 13989, 14311, 14599, 14761, 15011, 15409, 15449, 15829, 16013, 16357, 16969, 17131, 17149, 17177, 17663, 18293, 18383, 18991, 19099, 19187, 19307, 19369, 19493, 19579, 19658, 19667, 19879, 19907, 19959, 20093, 20131, 20765, 21469, 22387, 22597, 22927, 22991, 23299, 24839, 24901, 25003, 25401, 25807, 25927, 26291, 26447, 27667, 27723, 27859, 27877, 28877, 28939, 28981, 28997, 29227, 29321, 29878, 30679, 30767, 30799, 30997, 31909, 32961, 34309, 35215, 35269, 35833, 35939, 36289, 36989, 37249, 38093, 38159, 38641, 39289, 39797]

Let's test for 28299 which is listed under the digit 8 where we find that:
  • \(28299 = 3 \times 9433\)
  • \(828299 = 23 \times 36013\)
  • \(288299 = 11 \times 26209\)
  • \(282899 = 79 \times 3581\)
  • \(282989 = 7 \times 40427\)
  • \(282998 = 2 \times 141499\)
Here the results for sphenic numbers (permalink):

Digit 0:

None found in this range.

Digit 1:

[1595, 3245, 5258, 5710, 7015, 7718, 8255, 8395, 9185, 9878, 9915, 11018, 11194, 16511, 17005, 18518, 18758, 18778, 19245, 27911, 30354, 31665, 33115, 33514, 37614, 38129, 39179]

Digit 2:

[222, 282, 1742, 2222, 2586, 2782, 2922, 3286, 3342, 3926, 4342, 4362, 4722, 5066, 5246, 5262, 7582, 7622, 7782, 8706, 9726, 10622, 10642, 11822, 13782, 14126, 15026, 15422, 16402, 16682, 17122, 20802, 21566, 21962, 22026, 22202, 22782, 23026, 25782, 26942, 27122, 27282, 27726, 29926, 30522, 31002, 31922, 32426, 33242, 34302, 34922, 36182, 37022, 38222, 39422, 39482]

Digit 3:

[615, 1245, 1533, 2198, 2289, 2739, 3333, 3355, 3358, 3590, 5034, 5558, 5734, 6730, 7761, 8238, 8931, 9254, 12189, 12207, 12215, 12595, 13334, 15035, 15897, 15933, 16833, 17733, 18381, 18578, 18579, 18867, 20194, 20894, 23834, 24447, 25534, 28634, 28821, 30385, 30747, 30981, 31190, 32349, 32354, 32774, 33303, 33321, 33835, 33843, 33998, 35734, 37205, 37505, 37558, 38001, 38165, 38973, 39058, 39819, 39934]

Digit 4:

[345, 665, 1547, 1955, 2895, 4585, 4695, 5595, 6645, 7545, 7885, 8729, 9465, 9485, 9515, 9685, 9911, 9915, 10885, 12265, 14465, 19245, 19495, 22555, 25991, 26381, 26745, 29087, 32035, 32145, 32155, 35405]

Digit 5:

[385, 555, 595, 705, 1085, 1455, 2085, 2355, 2555, 2685, 2865, 3355, 3558, 3565, 3585, 4345, 4355, 4565, 4605, 5258, 5405, 5495, 5555, 5835, 5898, 6135, 6785, 6955, 6978, 7554, 7955, 8355, 8533, 9678, 10585, 11473, 12174, 12395, 13115, 13574, 14795, 15535, 17515, 17895, 19598, 20855, 20881, 21765, 21954, 23165, 25085, 25334, 25543, 25858, 26114, 26115, 26555, 26765, 28145, 28754, 29235, 30594, 30635, 30965, 32415, 33155, 33485, 34655, 35315, 35655, 35893, 36515, 36555, 37465, 37565, 37655, 38185, 38558, 39589, 39785, 39885, 39895]

Digit 6:

[186, 266, 582, 806, 906, 1266, 2266, 3562, 3606, 4462, 4966, 5486, 5622, 6086, 6386, 6886, 7966, 9266, 10366, 10586, 13166, 14162, 14806, 16702, 17366, 21626, 22526, 23246, 23446, 26966, 27062, 28262, 31666, 32662, 34226, 34622, 37226, 39742]

Digit 7:

[777, 4330, 4697, 4938, 5678, 5757, 7287, 7777, 7798, 8378, 8898, 9258, 17798, 19877, 23009, 25277, 29530, 29798, 30797, 32514, 36707, 36743, 37077]

Digit 8:

[2185, 2795, 2821, 6335, 8195, 8215, 8255, 8355, 8905, 9285, 10165, 11615, 14885, 18241, 18885, 26315, 30965, 31027, 34177]

Digit 9:

[399, 915, 1515, 2595, 2877, 2937, 2955, 2985, 3201, 3399, 3598, 3945, 4767, 5019, 5133, 5709, 6141, 6693, 7257, 7918, 8697, 8798, 9291, 9398, 9545, 9717, 10090, 10923, 14755, 15171, 15794, 18699, 19495, 19833, 19839, 19869, 19970, 20694, 21754, 21957, 22258, 22989, 23691, 24477, 25203, 25809, 27219, 29289, 29578, 30018, 32165, 34869, 35457, 36879, 39158, 39185]

Let's test for 28262 which is listed under the digit 6:
  • \(28262 = 2 \times 13 \times 1087 \)
  • \(628262 = 2 \times 53 \times 5927 \)
  • \(268262 = 2 \times 113 \times 1187 \)
  • \(286262 = 2 \times 41 \times3491 \)
  • \(282662 = 2 \times 79 \times 1789 \)
  • \(282626 = 2 \times251 \times 563 \)

Friday, 12 June 2026

Forming Palindromes from Factors

 In a blog post titled Why Is 313131 An Interesting Number?, I remarked that:

$$ 313131=3 \times 7 \times 13 \times 31 \times 37$$If we rearrange the order of multiplication we get the following:$$ 313131=7 \times 3 \times 13 \times 31 \times 37$$Concatenating these digits we get the number \(73133137\) which is palindromic.

I went on to look at what other numbers in the range between 28000 and 29000 have this property and came up with the table shown below:


The numbers are thus relatively rare, there being only 27 in a range of 1000 numbers. This represents a density of 2.7%. The numbers are listed below:

28072, 28125, 28194, 28224, 28242, 28273, 28308, 28322, 28332, 28416, 28431, 28448, 28585, 28589, 28593, 28601, 28602, 28609, 28620, 28672, 28685, 28692, 28750, 28800, 28812, 28847, 28951

The factors under consideration here are all PRIME factors. What if we allow factors that are not necessarily prime. Take 28200 as an example:$$ \begin{align} 28200 &= 2 \times 5 \times 3 \times 2 \times 235 \times 2 \\ &\rightarrow 25322352 \end{align}$$The resultant number after concatenation of the factors is palindromic. Notice that the factor 235 is NOT prime.

It turns out that palindromes constructed in this way are relatively frequent. In the range between 28100 and 28300 (a range of only 200), the density is 15.4%. The numbers are:

28104, 28105, 28125, 28126, 28128, 28130, 28140, 28143, 28152, 28160, 28161, 28175, 28179, 28180, 28182, 28188, 28194, 28200, 28224, 28230, 28236, 28242, 28251, 28256, 28266, 28273, 28275, 28280, 28288, 28296, 28300

I've set up my multipurpose algorithm to identify such numbers when they pop up in my diurnal age analysis.

Saturday, 30 May 2026

Some Categories of Primes

There is a category of prime numbers with the property that when both the sum of their digits and the product of their digits is added to the number then the new, resultant numbers are also prime. An example would be 28181 with a sum of digits of 20 and a product of digits of 128 where:$$ \begin{align} 28181 + 20 &= 28201 \text{ prime} \\ 28181 + 128 &= 28309 \text{ prime} \end{align}$$In the range up to 40000, these primes have a density of 7.376% compared to all primes. Here is a list of such primes between 28000 and 40000 (permalink):

28097, 28181, 28703, 28901, 29153, 29179, 29209, 30089, 30119, 30203, 30313, 30449, 30469, 30539, 30557, 30649, 30661, 30713, 30803, 30809, 30829, 31019, 31307, 32063, 32069, 32083, 32173, 32203, 32401, 32687, 32957, 32971, 33013, 33037, 33091, 33301, 33413, 33547, 33581, 33587, 33769, 33851, 34313, 34667, 35053, 35059, 35251, 35257, 35323, 35507, 35509, 35521, 35569, 35831, 36209, 36229, 36469, 36559, 36607, 36919, 37019, 37039, 37097, 37321, 37369, 37501, 37507, 37547, 37871, 38047, 38351, 38959, 39019, 39079, 39103, 39161, 39301, 39521

These primes constitute OEIS A128717:


A128717: primes that yield another prime if one adds either the sum of its digits or the product of its digits.


Another category of prime involves its cube being pandigital, meaning that each digit from 0 to 9 occurs at least once with duplicates being permitted. Again 28181 satisfies this condition:$$28181^3 = 20753798525641$$Primes of this sort constitute:


A124629: primes \(p\) such that their cubes are pandigital.


The members of this sequence up to 40000 have a density is 1.523 % compared to all primes and these are (permalink):

5437, 6221, 7219, 8443, 10903, 11353, 15937, 17123, 18229, 19429, 20353, 20903, 20929, 21803, 21841, 21961, 22123, 22283, 22993, 23053, 23369, 23663, 24733, 25183, 25219, 25463, 26317, 26387, 26449, 27127, 27481, 28181, 28631, 28711, 28961, 29059, 29443, 29501, 30169, 31153, 31183, 32213, 32801, 33739, 33797, 33811, 33941, 34283, 35027, 35051, 35729, 35963, 36137, 36251, 36383, 36809, 36943, 37223, 37369, 37511, 37619, 37967, 38281, 38917

Another category of prime involves the average of the prime and the next prime being palindromic. Again 28181 satisfies since:$$ \frac{28181+28183}{2}=28182$$Many such primes are the lesser of a twin prime pair but not all. Primes of this sort constitute OEIS A242387:


A242387: lesser of consecutive primes whose average is a palindromic number.


The members of this sequence up to 40000 have a density of 1.213% compared to all primes and these are (permalink):

3, 5, 7, 97, 109, 281, 359, 389, 409, 509, 631, 653, 691, 743, 827, 857, 907, 937, 967, 1549, 2111, 2767, 4219, 4441, 7001, 9007, 9337, 9661, 10099, 11503, 12919, 13421, 16759, 17569, 21011, 21611, 23831, 26261, 26861, 28181, 29287, 29483, 30497, 31307, 32213, 33029, 33629, 34739, 36353, 37463, 39089

Another category of prime involves the differences between consecutive digits. Some primes have consecutive digits that differ by 6 or 7. An example is 28181 where we see that:$$ 2_{ \, 6} \, 8_{ \, 7} \, 1_{ \, 7} \, 8_{ \, 7} \, 1$$Such primes are few and far between and in the range up 40000, there are only the following:

17, 29, 71, 181, 281, 293, 607, 829, 929, 2939, 3929, 8171, 8293, 9281, 9293, 18181, 28181, 39293

Such primes belong to OEIS A048418:


A048418: primes whose consecutive digits differ by 6 or 7.


Yes another category involves totals of composite numbers between successive primes that are palindromes. 28181 qualifies once again because the next prime is its twin 28183 and the interprime number, 28182, is palindromic. Let's consider another prime, 29587. The next prime is 29599 and the composite numbers between them total 325523, a palindrome. Therefore we include 29587. These primes form OEIS A054266 with a density of only 0.8089% of the primes in the range up to 40000:


A054266: sum of composite numbers between prime \(p\) and nextprime(\(p\)) is palindromic.


The members up to 40000 are (permalink):

2, 3, 5, 109, 193, 281, 509, 661, 827, 857, 1439, 2111, 3433, 3889, 3967, 4549, 6661, 7001, 8467, 10099, 17203, 18583, 21011, 21611, 23831, 24847, 25117, 26261, 26497, 26861, 28181, 29587, 30497, 31307

We see that 28181, my diurnal age today, features in all these different categories of primes. Another category of primes (to which 28181 cannot belong) is to consider primes that only consist of non-prime digits (0, 1, 4, 6, 8 and 9). They do not contain any prime digits (2, 3, 5 or 7). Such primes belong to OEIS A034844 and comprise 5.782% of the primes up to 40000:


A034844: primes with only nonprime decimal digits.


Here are the primes up to 40000 (permalink):

11, 19, 41, 61, 89, 101, 109, 149, 181, 191, 199, 401, 409, 419, 449, 461, 491, 499, 601, 619, 641, 661, 691, 809, 811, 881, 911, 919, 941, 991, 1009, 1019, 1049, 1061, 1069, 1091, 1109, 1181, 1409, 1481, 1489, 1499, 1601, 1609, 1619, 1669, 1699, 1801, 1811, 1861, 1889, 1901, 1949, 1999, 4001, 4019, 4049, 4091, 4099, 4111, 4409, 4441, 4481, 4649, 4691, 4801, 4861, 4889, 4909, 4919, 4969, 4999, 6011, 6089, 6091, 6101, 6199, 6449, 6469, 6481, 6491, 6619, 6661, 6689, 6691, 6841, 6869, 6899, 6911, 6949, 6961, 6991, 8009, 8011, 8069, 8081, 8089, 8101, 8111, 8161, 8191, 8419, 8461, 8609, 8641, 8669, 8681, 8689, 8699, 8819, 8849, 8861, 8941, 8969, 8999, 9001, 9011, 9041, 9049, 9091, 9109, 9161, 9181, 9199, 9419, 9461, 9491, 9601, 9619, 9649, 9661, 9689, 9811, 9901, 9941, 9949, 10009, 10061, 10069, 10091, 10099, 10111, 10141, 10169, 10181, 10499, 10601, 10691, 10861, 10889, 10891, 10909, 10949, 11069, 11119, 11149, 11161, 11411, 11489, 11491, 11681, 11689, 11699, 11801, 11909, 11941, 11969, 11981, 14009, 14011, 14081, 14149, 14401, 14411, 14419, 14449, 14461, 14489, 14669, 14699, 14869, 14891, 14969, 16001, 16061, 16069, 16091, 16111, 16141, 16189, 16411, 16481, 16619, 16649, 16661, 16691, 16699, 16811, 16889, 16901, 16981, 18041, 18049, 18061, 18089, 18119, 18149, 18169, 18181, 18191, 18199, 18401, 18461, 18481, 18661, 18691, 18869, 18899, 18911, 18919, 19001, 19009, 19069, 19081, 19141, 19181, 19441, 19469, 19489, 19609, 19661, 19681, 19699, 19801, 19819, 19841, 19861, 19889, 19891, 19919, 19949, 19961, 19991

Primes beginning with 2 or 3 cannot qualify and so it is only when we reach primes beginning with 4 that membership is possible. The first of these is 40009.

We can flip this and consider only those primes that are comprised of prime digits. These form OEIS A019546:


A019546: primes whose digits are primes; primes having only {2, 3, 5, 7} as digits.


These primes have a density of 2.890% of the primes up to 40000 are they are (permalink):

2, 3, 5, 7, 23, 37, 53, 73, 223, 227, 233, 257, 277, 337, 353, 373, 523, 557, 577, 727, 733, 757, 773, 2237, 2273, 2333, 2357, 2377, 2557, 2753, 2777, 3253, 3257, 3323, 3373, 3527, 3533, 3557, 3727, 3733, 5227, 5233, 5237, 5273, 5323, 5333, 5527, 5557, 5573, 5737, 7237, 7253, 7333, 7523, 7537, 7573, 7577, 7723, 7727, 7753, 7757, 22273, 22277, 22573, 22727, 22777, 23227, 23327, 23333, 23357, 23537, 23557, 23753, 23773, 25237, 25253, 25357, 25373, 25523, 25537, 25577, 25733, 27253, 27277, 27337, 27527, 27733, 27737, 27773, 32233, 32237, 32257, 32323, 32327, 32353, 32377, 32533, 32537, 32573, 33223, 33353, 33377, 33533, 33577, 33757, 33773, 35227, 35257, 35323, 35327, 35353, 35527, 35533, 35537, 35573, 35753, 37223, 37253, 37273, 37277, 37337, 37357, 37537, 37573

Monday, 18 May 2026

Highly Primeable Numbers

A composite numbers is primeable if it can be made prime by changing a single digit. If it cannot, then it is said to be unprimeable. What struck me about the number associated with my diurnal age today (28169) is how many ways (10) in which it can be made prime.

28169 is NOT unprimeable. It can be made prime with the following changes (permalink):

- Changing the '2' at position 1 (from the left) to '1' yields 18169
- Changing the '2' at position 1 (from the left) to '5' yields 58169
- Changing the '2' at position 1 (from the left) to '8' yields 88169
- Changing the '8' at position 2 (from the left) to '1' yields 21169
- Changing the '8' at position 2 (from the left) to '4' yields 24169
- Changing the '8' at position 2 (from the left) to '5' yields 25169
- Changing the '1' at position 3 (from the left) to '0' yields 28069
- Changing the '1' at position 3 (from the left) to '6' yields 28669
- Changing the '6' at position 4 (from the left) to '0' yields 28109
- Changing the '9' at position 5 (from the left) to '3' yields 28163

This got me thinking about highly primeable numbers and what numbers are record breakers by setting records for the number of ways in which they can be made prime. I got Gemini to write a program to investigate this and here is what it came up with in the range up to 100000 (permalink):

Record-Breaking Primeable Numbers
----------------------------------------
Number          | Ways to Make Prime
----------------------------------------
4               | 4
21              | 7
33              | 8
111             | 10
133             | 11
177             | 13
357             | 14
1001            | 15
4221            | 16
10759           | 17
11487           | 18
42189           | 20
----------------------------------------

Here is the list of numbers: 4, 21, 33, 111, 133, 177, 357, 1001, 4221, 10759, 11487, 42189.

So we see that 28169, though highly primeable, is NOT a record breaker.

Let's look at the 20 ways in which 42189 can be made prime:

42189 is NOT unprimeable. It can be made prime with the following changes (permalink):
- Changing the '4' at position 1 (from the left) to '2' yields 22189 - Changing the '4' at position 1 (from the left) to '3' yields 32189 - Changing the '4' at position 1 (from the left) to '5' yields 52189 - Changing the '4' at position 1 (from the left) to '6' yields 62189 - Changing the '4' at position 1 (from the left) to '8' yields 82189 - Changing the '4' at position 1 (from the left) to '9' yields 92189 - Changing the '2' at position 2 (from the left) to '0' yields 40189 - Changing the '2' at position 2 (from the left) to '1' yields 41189 - Changing the '2' at position 2 (from the left) to '3' yields 43189 - Changing the '2' at position 2 (from the left) to '4' yields 44189 - Changing the '2' at position 2 (from the left) to '7' yields 47189 - Changing the '1' at position 3 (from the left) to '0' yields 42089 - Changing the '1' at position 3 (from the left) to '5' yields 42589 - Changing the '1' at position 3 (from the left) to '6' yields 42689 - Changing the '1' at position 3 (from the left) to '9' yields 42989 - Changing the '8' at position 4 (from the left) to '3' yields 42139 - Changing the '8' at position 4 (from the left) to '6' yields 42169 - Changing the '8' at position 4 (from the left) to '7' yields 42179 - Changing the '9' at position 5 (from the left) to '1' yields 42181 - Changing the '9' at position 5 (from the left) to '7' yields 42187

While the above table shows record breakers, there are other numbers that equal existing records but do NOT set those records themselves. The following table shows these numbers (permalink) in the range up to 100,000.

Numbers Equaling an Existing Record
----------------------------------------
Number          | Ways to Make Prime
----------------------------------------
6               | 4
8               | 4
9               | 4
10              | 4
12              | 4
14              | 4
15              | 4
16              | 4
18              | 4
27              | 7
49              | 8
63              | 8
77              | 8
119             | 10
147             | 11
153             | 11
1011            | 15
1099            | 15
1209            | 15
1623            | 15
10637           | 16
13699           | 18
14421           | 18
16457           | 18
21717           | 18
31647           | 18
----------------------------------------

 Here is a comma-separated list of these numbers:

6, 8, 9, 10, 12, 14, 15, 16, 18, 27, 49, 63, 77, 119, 147, 153, 1011, 1099, 1209, 1623, 10637, 13699, 14421, 16457, 21717, 31647

Wednesday, 28 January 2026

Number's Divisors to Sequence Algorithm

A logical progression to looking at the sequence produced by considering the factors of a number (see Number's Factors to Sequence Algorithm 1 and Number's Factors to Sequence Algorithm 2) is to consider the sequence formed by its divisors. The rules this time around are very similar to that for factors except that we are dealing now with the number's divisors.

 Suppose we take any positive integer \(n \gt 1\) 
  • if prime, double it and add 1: \(n \rightarrow 2n+1\)
  • if composite, determine its number of divisors \(d\)
  • if \( n \pmod d \equiv 0\) then \(n \rightarrow \dfrac{n}{d} \)
  • if \( n \pmod d \not\equiv 0 \) then \(n \rightarrow n \times d\)
Keep repeating this process until a loop is reached or call a stop after a fixed number of iterations. 

Let's use 28059 as an example. Applying the above rules leads to the following sequence:

28059, 224472, 7183104, 517183488, 2693664, 37412, 448944, 17957760, 140295, 2244720, 28059

We end up right where we started. Here the details with number of divisors shown (permalink):
28059 --> 8
224472 --> 32
7183104 --> 72
517183488 --> 192
2693664 --> 72
37412 --> 12
448944 --> 40
17957760 --> 128
140295 --> 16
2244720 --> 80
28059 --> 8
As before we are interested in record lengths and my algorithm was not up to the job of determing these so I had to call on Gemini for help. It came up with the following record breaking numbers in the range up to one million (permalink). This algorithm proved to be faulty. For the correction see blog post titled "A Correction".

2, 3, 6, 11, 22, 44, 50, 99, 125, 206, 350, 463, 487, 974, 1375, 1573, 1625, 5200, 14157, 16879, 18747, 39325, 89237, 151911, 563553, 803133

Here are the details of the lengths:

Number     | Length     | Status
-----------------------------------
2          | 5          | New Record!     
3          | 8          | New Record!     
6          | 10         | New Record!     
11         | 21         | New Record!     
22         | 23         | New Record!     
44         | 25         | New Record!     
50         | 28         | New Record!     
99         | 32         | New Record!     
125        | 33         | New Record!     
206        | 34         | New Record!     
350        | 37         | New Record!     
463        | 44         | New Record!     
487        | 46         | New Record!     
974        | 48         | New Record!     
1375       | 51         | New Record!     
1573       | 52         | New Record!     
1625       | 60         | New Record!     
5200       | 62         | New Record!     
14157      | 63         | New Record!     
16879      | 64         | New Record!     
18747      | 67         | New Record!     
39325      | 70         | New Record!     
89237      | 71         | New Record!     
151911     | 75         | New Record!     
563553     | 77         | New Record!     
803133     | 82         | New Record!  

Let's look at the sequence for the last number in the above list, 803133 (permalink):

803133, 4818798, 77100768, 1606266, 19275192, 616806144, 8566752, 356948, 2141688, 34267008, 1070844, 89237, 178475, 3212550, 346955400, 149884732800, 115651800, 321255, 11565180, 64251, 1156518, 69391080, 19984631040, 23130360, 5551286400, 6425100, 1040866200, 524596564800, 231303600, 514008, 7139, 42834, 1028016, 92521440, 257004, 13878216, 1998463104, 5204331, 218581902, 41967725184, 48573756, 10491931296, 16191252, 2914425360, 3469554, 249807888, 59953893120, 61680960, 20724802560, 15700608, 4019355648, 7850304, 35046, 1121472, 125604864, 356832, 3717, 44604, 2140992, 299738880, 555072, 6608, 132160, 2360, 37760, 1180, 14160, 354, 2832, 56640, 3171840, 19824, 792960, 6195, 99120, 1239, 9912, 317184, 22837248, 118944, 1652, 19824

Like the previous sequences using the number of factors, this sequence using the number of divisors is also \( \textbf{base independent}\).

Tuesday, 27 January 2026

Number's Factors to Sequence Algorithm 1

Suppose we take any positive integer \(n \gt 1\) and apply the following rules to it:
  • if prime, double it and add 1: \(n \rightarrow 2n+1\)
  • if composite, determine its number of factors \(f\) counted with multiplicity
  • if \( n \pmod f \equiv 0\) then \(n \rightarrow \dfrac{n}{f} \)
  • if \( n \pmod f \not\equiv 0 \) then \(n \rightarrow n \times f\)
Keep repeating this process until a loop is reached or call a stop after a fixed number of iterations. Let's use 28058 as an example. The sequence generated is 28058, 14029, 28059, 9353, 18706, 56118, 224472, 37412, 9353 and the details are as follows:

  • \(28058 = 2 \times 14029\) and there are two factors
    2 divides 28056 to give 14209

  • \(14029\) is prime
    multiplying by 2 and adding 1 we get 28059

  • \(28059 = 3 \times 47 \times 199\) and there are three factors
    3 divides 28059 to give 9353

  • \(9353 = 47 \times 199\) and there are two factors but 2 doesn't divide 9353
    multiplying by 2 gives 18706

  • \(18706 = 2 \times 47 \times 199\) and there are three factors but 3 doesn't divide 18706
    multiplying by 3 gives 56118

  • \(56118 = 2 \times 3 \times 47 \times 199\) and there are four factors but 4 doesn't divide 56118
    multiplying by 4 gives 224472

  • \(224472 = 2^3 \times 3 \times 47 \times 199\) and there are six factors (with multiplicity)
    6 divides 224472 to give 37412

  • \(37412 = 2^2 \times 47 \times 199\) and there are four factors (with multiplicity)
    4 divides 37412 to give 9353

  • \(9353\) occurred earlier in the sequence and so we have a loop
Figure 1 shows the trajectory.


Figure 1

Some numbers return to their starting points. 27056 is one such number. It's sequence is 28056, 4676, 1169, 2338, 7014, 28056. What appeals to me about this sequence is that it is \( \textbf{base independent}\). Here is permalink to generate the sequence of any number entered into it.

An investigation into what numbers produced sequences of record lengths returned the following number in the range up to one million:

2, 3, 6, 8, 13, 19, 38, 57, 76, 304, 1024, 1579, 2401, 3584, 10331, 12119, 12500, 15379, 24251, 30689, 48661, 57122, 66749, 116603, 155201, 232801, 465602, 698403, 931204

The final number in the list (931204) produces a sequence of length 155. Here are the full details for all the numbers in the list (permalink):
2 --> 11
3 --> 15
6 --> 16
8 --> 18
13 --> 20
19 --> 24
38 --> 25
57 --> 27
76 --> 29
304 --> 32
1024 --> 34
1579 --> 40
2401 --> 43
3584 --> 49
10331 --> 51
12119 --> 53
12500 --> 61
15379 --> 64
24251 --> 65
30689 --> 66
48661 --> 69
57122 --> 92
66749 --> 105
116603 --> 145
155201 --> 146
232801 --> 150
465602 --> 151
698403 --> 153
931204 --> 155

The sequence for 931204 is as follows: 

931204, 2793612, 698403, 1396806, 465602, 232801, 465603, 931206, 310402, 155201, 310403, 1241612, 7449672, 931209, 4656045, 27936270, 223490160, 2458391760, 204865980, 1843793820, 167617620, 16761762, 134094096, 1475035056, 122919588, 13657732, 95604124, 764832992, 69530272, 695302720, 8343632640, 556242176, 7231148288, 516510592, 6198127104, 92971906560, 5468935680, 341808480, 28484040, 256356360, 2819919960, 234993330, 26110370, 182772590, 1462180720, 132925520, 13292552, 1661569, 8307845, 49847070, 398776560, 4386542160, 365545180, 3289906620, 299082420, 29908242, 239265936, 2631925296, 219327108, 1973943972, 179449452, 1794494520, 149541210, 16615690, 2373670, 14242020, 113936160, 1253297760, 104441480, 939973320, 85452120, 8545212, 68361696, 751978656, 62664888, 563983992, 51271272, 512712720, 42726060, 4747340, 33231380, 265851040, 2924361440, 35092337280, 2339489152, 179960704, 2159528448, 32392926720, 550679754240, 30593319680, 458899795200, 26994105600, 1687131600, 140594300, 1265348700, 115031700, 11503170, 92025360, 1012278960, 84356580, 759209220, 69019020, 6901902, 55215216, 607367376, 50613948, 5623772, 803396, 4820376, 602547, 3012735, 18076410, 144611280, 13146480, 1314648, 164331, 821655, 4929930, 39439440, 433833840, 36152820, 4016980, 28118860, 224950880, 20450080, 2045008, 255626, 1278130, 7668780, 61350240, 674852640, 56237720, 506139480, 46012680, 4601268, 36810144, 404911584, 33742632, 303683688, 27607608, 276076080, 23006340, 2556260, 365180, 2191080, 273885, 54777, 219108, 36518, 146072, 876432, 109554, 547770, 91295, 365180

The range of values in this sequence is extreme, ranging from a minimum of 36,518 to a maximum of 550,679,754,240. Figure 2 shows the trajectory with a log scale being necessary for the \(y\) axis.


Figure 2