Wednesday, 27 August 2025

Five Five Numbers

The number associated with my diurnal age today, \( \textbf{27905} \), is one of those numbers that it is difficult to find anything of interest about. However, as usual, a little investigation turned up something special about it. It is what I call a five five number meaning it meets the following criteria:

  • it is a composite and squarefree number
  • its digits contain a single 5
  • each prime factor contains at least one 5 for a total of three 5's
  • its arithmetical digital root is 5


In the range up to 40000, there are only six numbers that satisfy these criteria and they are 12785, 27635, 27815, 27905, 28265 and 32765. Here are the details (permalink):

 number   factors    root

  12785    5 * 2557   5
  27635    5 * 5527   5
  27815    5 * 5563   5
  27905    5 * 5581   5
  28265    5 * 5653   5
  32765    5 * 6553   5

You could extend this idea to digits other than \( \textbf{5} \). The digit \( \textbf{3} \) produces too many suitable numbers but what about the digit \( \textbf{4} \) where we require this of the number:
  • it is a composite and squarefree number
  • its digits contain a single 4
  • each prime factor contains at least one 4 for a total of two 4's
  • its arithmetical digital root is 4


In the range up to 40000, only one number satisfies and that is 19147 = 41 x 467 with a digital root of 4 (permalink). Nothing for the digit \( \textbf{6} \) up to one million. For the digit \( \textbf{7} \) there is only one number up to one million and that is 544579 = 7 x 77797 with a digital root of 7 - we require that its prime factors contain a total of five 7's (permalink). For the digits \( \textbf{8} \) and \( \textbf{9} \), no numbers qualify up to one million.

So it turns out that 27905 is not so uninteresting after all. Additionally, it is a \( \textbf{Proth} \) number, since it is equal to \(109 \times 2^8 + 1\) and \(109 < 28 \). I've written about these before in a post titled Proth Numbers.

Monday, 25 August 2025

Primes from Primes

Following on from my previous post, let's consider primes such that, when we add their consecutive pairs of digits together and concatenate them, we end up with another prime. Let's consider an example. I recently turned \( \textbf{27901}\) days old. This number is prime and this is what happens when we apply these operations to the number:$$  \underbrace{2+7}_{ \Large 9} \quad \underbrace{7+9}_{\Large 16} \quad  \underbrace{9+0}_{ \Large 9} \quad \underbrace{0+1}_{ \Large 1} \rightarrow 91691 \text{ a prime number}  $$In the range up to 40000, there are 403 numbers that satisfy the criteria. I'll show the 101 numbers from 27901 to 40000 below (permalink):

27901, 28081, 28163, 28201, 28229, 28447, 28607, 28621, 28627, 28661, 28703, 28867, 28927, 28961, 29009, 29021, 29063, 29129, 29167, 29201, 29207, 29221, 29401, 29567, 29789, 29881, 29921, 30029, 30089, 30109, 30427, 30509, 30643, 30649, 30763, 30781, 30809, 30829, 30983, 31249, 31627, 31663, 31849, 31883, 32009, 32089, 32189, 32401, 32429, 32563, 32609, 32749, 32843, 32909, 33029, 33149, 33289, 33349, 33529, 33601, 33829, 33889, 34147, 34261, 34327, 34483, 34501, 34583, 34589, 34807, 34963, 35089, 35129, 35401, 35461, 35543, 35603, 36109, 36209, 36229, 36721, 36901, 37021, 37189, 37409, 37589, 37747, 37963, 38047, 38149, 38461, 38629, 38707, 38729, 39103, 39229, 39409, 39503, 39749, 39829, 39929

Let's take the last number, 39929, as a second example:$$  \underbrace{3+9}_{ \Large 12} \quad \underbrace{9+9}_{\Large 18} \quad  \underbrace{9+2}_{ \Large 11} \quad \underbrace{2+9}_{ \Large 11} \rightarrow 12181111 \text{ a prime number}  $$For completeness, here are primes that arise from the above primes:

27901 --> 91691
28081 --> 10889
28163 --> 10979
28201 --> 101021
28229 --> 1010411
28447 --> 1012811
28607 --> 101467
28621 --> 101483
28627 --> 101489
28661 --> 1014127
28703 --> 101573
28867 --> 10161413
28927 --> 1017119
28961 --> 1017157
29009 --> 11909
29021 --> 11923
29063 --> 11969
29129 --> 1110311
29167 --> 1110713
29201 --> 111121
29207 --> 111127
29221 --> 111143
29401 --> 111341
29567 --> 11141113
29789 --> 11161517
29881 --> 1117169
29921 --> 1118113
30029 --> 30211
30089 --> 30817
30109 --> 3119
30427 --> 3469
30509 --> 3559
30643 --> 36107
30649 --> 361013
30763 --> 37139
30781 --> 37159
30809 --> 3889
30829 --> 381011
30983 --> 391711
31249 --> 43613
31627 --> 4789
31663 --> 47129
31849 --> 491213
31883 --> 491611
32009 --> 5209
32089 --> 52817
32189 --> 53917
32401 --> 5641
32429 --> 56611
32563 --> 57119
32609 --> 5869
32749 --> 591113
32843 --> 510127
32909 --> 51199
33029 --> 63211
33149 --> 64513
33289 --> 651017
33349 --> 66713
33529 --> 68711
33601 --> 6961
33829 --> 6111011
33889 --> 6111617
34147 --> 75511
34261 --> 7687
34327 --> 7759
34483 --> 781211
34501 --> 7951
34583 --> 791311
34589 --> 791317
34807 --> 71287
34963 --> 713159
35089 --> 85817
35129 --> 86311
35401 --> 8941
35461 --> 89107
35543 --> 81097
35603 --> 81163
36109 --> 9719
36209 --> 9829
36229 --> 98411
36721 --> 91393
36901 --> 91591
37021 --> 10723
37189 --> 108917
37409 --> 101149
37589 --> 10121317
37747 --> 10141111
37963 --> 1016159
38047 --> 118411
38149 --> 119513
38461 --> 1112107
38629 --> 1114811
38707 --> 111577
38729 --> 1115911
39103 --> 121013
39229 --> 1211411
39409 --> 121349
39503 --> 121453
39749 --> 12161113
39829 --> 12171011
39929 --> 12181111

What if we convert the prime numbers in base 10 to numbers in other bases. These numbers will remain prime of course and then we apply the operations but in our chosen base. Let's work with base 9. In the range from 27901 up to 40000, 121 numbers satisfy (permalink):

28123, 28211, 28279, 28297, 28463, 28513, 28517, 28549, 28621, 28663, 28697, 28711, 28789, 28859, 28933, 29167, 29221, 29251, 29269, 29399, 29527, 29581, 29669, 29683, 29759, 29761, 29917, 29921, 30013, 30133, 30139, 30187, 30553, 30677, 30763, 30839, 30841, 30871, 30949, 31159, 31181, 31219, 31249, 31271, 31357, 31397, 31489, 31541, 32059, 32077, 32083, 32099, 32353, 32491, 32497, 32621, 32653, 32783, 32917, 32939, 32987, 33149, 33331, 33461, 33479, 33581, 33617, 33619, 33641, 33851, 34019, 34033, 34127, 34211, 34303, 34429, 34537, 34607, 34757, 34897, 34913, 34919, 35081, 35291, 35363, 35401, 35423, 35509, 35617, 35671, 35747, 35837, 35869, 35923, 35963, 35993, 36011, 36389, 36479, 36571, 36767, 36857, 36929, 37199, 37273, 37307, 37313, 37361, 37397, 37997, 38083, 38261, 38321, 38447, 38461, 38677, 38933, 39041, 39233, 39239, 39857

Let's look at 39239, the second last number in that list. It becomes 58738 in base 9.$$ \begin{align} 28219_{\, 10} = 58738_{ \, 9} &\rightarrow \underbrace{5+8}_{ \Large 14} \quad \underbrace{8+7}_{\Large 16} \quad \underbrace{7+3}_{ \Large 11} \quad \underbrace{3+8}_{ \Large 12}\\ \\ &\rightarrow 14161112_{\,9} \text{ a prime number} \\ \\ &= 7007969_{\,10} \text{ also prime} \end{align}$$The details are as follows (first column is base 10 prime, second column is prime in base 9, third prime is the prime resulting from the operations of addition and concatenation in base 9 and the fourth column is the prime converted to a prime in base 10.

28123 --> 42517 --> 6768 --> 5003
28211 --> 42625 --> 6887 --> 5101
28279 --> 42711 --> 61082 --> 40169
28297 --> 42731 --> 610114 --> 360949
28463 --> 43035 --> 7338 --> 5381
28513 --> 43101 --> 7411 --> 5437
28517 --> 43105 --> 7415 --> 5441
28549 --> 43141 --> 7455 --> 5477
28621 --> 43231 --> 7554 --> 5557
28663 --> 43277 --> 751015 --> 446891
28697 --> 43325 --> 7657 --> 5641
28711 --> 43341 --> 7675 --> 5657
28789 --> 43437 --> 77711 --> 51607
28859 --> 43525 --> 7877 --> 5821
28933 --> 43617 --> 71078 --> 46727
29167 --> 44007 --> 8407 --> 6163
29221 --> 44067 --> 84614 --> 55903
29251 --> 44111 --> 8522 --> 6257
29269 --> 44131 --> 8544 --> 6277
29399 --> 44285 --> 861114 --> 512581
29527 --> 44447 --> 88812 --> 58979
29581 --> 44517 --> 81068 --> 53279
29669 --> 44625 --> 81187 --> 53377
29683 --> 44641 --> 811115 --> 479777
29759 --> 44735 --> 812118 --> 480509
29761 --> 44737 --> 8121111 --> 4324519
29917 --> 45031 --> 10534 --> 6997
29921 --> 45035 --> 10538 --> 7001
30013 --> 45147 --> 106512 --> 63839
30133 --> 45301 --> 10831 --> 7237
30139 --> 45307 --> 10837 --> 7243
30187 --> 45361 --> 108107 --> 64969
30553 --> 45817 --> 1014108 --> 541007
30677 --> 46065 --> 116612 --> 70481
30763 --> 46171 --> 11788 --> 7937
30839 --> 46265 --> 118812 --> 72101
30841 --> 46267 --> 118814 --> 72103
30871 --> 46311 --> 111042 --> 66377
30949 --> 46407 --> 111147 --> 66463
31159 --> 46661 --> 1113137 --> 599353
31181 --> 46685 --> 11131514 --> 5394289
31219 --> 46737 --> 11141111 --> 5400523
31249 --> 46771 --> 1114158 --> 600101
31271 --> 46805 --> 111585 --> 66821
31357 --> 47011 --> 12712 --> 8597
31397 --> 47055 --> 127511 --> 77689
31489 --> 47167 --> 128714 --> 78583
31541 --> 47235 --> 121058 --> 72953
32059 --> 47871 --> 1216168 --> 660617
32077 --> 48001 --> 13801 --> 9397
32083 --> 48007 --> 13807 --> 9403
32099 --> 48025 --> 13827 --> 9421
32353 --> 48337 --> 1312611 --> 717103
32491 --> 48511 --> 131462 --> 79841
32497 --> 48517 --> 131468 --> 79847
32621 --> 48665 --> 13151312 --> 6470129
32653 --> 48711 --> 131682 --> 80021
32783 --> 48865 --> 13171512 --> 6483413
32917 --> 50134 --> 5147 --> 3769
32939 --> 50158 --> 51614 --> 34033
32987 --> 50222 --> 5244 --> 3847
33149 --> 50422 --> 5464 --> 4027
33331 --> 50644 --> 56118 --> 37277
33461 --> 50808 --> 5888 --> 4373
33479 --> 50828 --> 581111 --> 348553
33581 --> 51052 --> 6157 --> 4507
33617 --> 51102 --> 6212 --> 4547
33619 --> 51104 --> 6214 --> 4549
33641 --> 51128 --> 62311 --> 41077
33851 --> 51382 --> 641211 --> 381439
34019 --> 51588 --> 661417 --> 394729
34033 --> 51614 --> 6775 --> 5009
34127 --> 51728 --> 681011 --> 407521
34211 --> 51832 --> 610125 --> 360959
34303 --> 52044 --> 7248 --> 5309
34429 --> 52204 --> 7424 --> 5449
34537 --> 52334 --> 7567 --> 5569
34607 --> 52422 --> 7664 --> 5647
34757 --> 52608 --> 7868 --> 5813
34897 --> 52774 --> 7101512 --> 3780281
34913 --> 52802 --> 71182 --> 46811
34919 --> 52808 --> 71188 --> 46817
35081 --> 53108 --> 8418 --> 6173
35291 --> 53362 --> 86108 --> 56951
35363 --> 53452 --> 87107 --> 57679
35401 --> 53504 --> 8854 --> 6529
35423 --> 53528 --> 88711 --> 58897
35509 --> 53634 --> 810107 --> 479041
35617 --> 53764 --> 8111411 --> 4318201
35671 --> 53834 --> 812127 --> 480517
35747 --> 54028 --> 104211 --> 62137
35837 --> 54138 --> 105412 --> 63029
35869 --> 54174 --> 105812 --> 63353
35923 --> 54244 --> 10668 --> 7109
35963 --> 54288 --> 1061117 --> 571633
35993 --> 54332 --> 10765 --> 7187
36011 --> 54352 --> 10787 --> 7207
36389 --> 54822 --> 1013114 --> 540283
36479 --> 55032 --> 11535 --> 7727
36571 --> 55144 --> 11658 --> 7829
36767 --> 55382 --> 1181211 --> 643879
36857 --> 55502 --> 111152 --> 66467
36929 --> 55582 --> 11111411 --> 5381083
37199 --> 56022 --> 12624 --> 8527
37273 --> 56114 --> 12725 --> 8609
37307 --> 56152 --> 12767 --> 8647
37313 --> 56158 --> 127614 --> 77773
37361 --> 56222 --> 12844 --> 8707
37397 --> 56262 --> 12888 --> 8747
37997 --> 57108 --> 13818 --> 9413
38083 --> 57214 --> 131035 --> 79493
38261 --> 57432 --> 131275 --> 79691
38321 --> 57508 --> 131358 --> 79757
38447 --> 57658 --> 13141214 --> 6463489
38461 --> 57674 --> 13141412 --> 6463649
38677 --> 58044 --> 14848 --> 10169
38933 --> 58358 --> 1412814 --> 776317
39041 --> 58488 --> 14131317 --> 6988453
39233 --> 58732 --> 1416115 --> 778667
39239 --> 58738 --> 14161112 --> 7007969
39857 --> 60605 --> 6665 --> 4919

Saturday, 23 August 2025

Fun With Primes and Digit Pairs

One of the interesting mathematical facts about the number associated with my diurnal age today, \( \textbf{27901} \), is that it is prime and the sums of all pairs of its successive digits are \( \textbf{square} \) numbers. We have:$$ \begin{align} 2 + 7 &= 9 = 3^2 \\ 7 + 9 &= 16 = 4^2 \\ 9 + 0 &= 9 = 3^2 \\ 0+1 &= 1 = 1^2 \end{align}$$Such numbers are few and far between. In fact, up to 40000, there are only 41 of them and they belong to OEIS A108659 (permalink):

\( \textbf{primes with the sums of all pairs of successive digits square} \)

13, 31, 79, 97, 101, 109, 131, 181, 227, 313, 401, 409, 631, 727, 797, 881, 1009, 1013, 1097, 2797, 3109, 3181, 3631, 4001, 4013, 7901, 8101, 9001, 9013, 10009, 10181, 10909, 10979, 13109, 18131, 18181, 22279, 22727, 27901, 31013, 36313

If a number is prime and the sums of all pairs of successive digits are \( \textbf{prime} \) as well then we find that there are 160 numbers that qualify in the range up 40000 (permalink):

\( \textbf{primes with the sums of all pairs of successive digits prime} \)

11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 149, 167, 211, 307, 347, 349, 383, 389, 503, 521, 523, 743, 761, 929, 941, 947, 983, 1123, 1129, 2029, 2111, 2129, 2141, 2143, 2161, 2341, 2347, 2383, 2389, 2503, 2521, 3023, 3203, 4111, 4129, 4349, 4703, 4943, 5021, 5023, 6121, 6143, 6521, 6529, 6703, 6761, 7411, 8329, 8389, 8521, 8923, 8929, 8941, 9203, 11149, 11161, 11411, 12143, 12149, 12161, 12323, 12329, 12343, 12347, 12503, 12583, 12589, 12923, 12941, 12983, 14143, 14149, 14303, 14321, 14323, 14341, 14347, 14389, 14741, 14747, 14767, 14923, 14929, 14947, 14983, 16111, 16141, 16529, 16561, 16567, 16703, 16741, 16747, 20323, 20341, 20347, 20389, 20507, 20521, 20707, 20743, 20747, 20749, 21121, 21143, 21149, 21211, 21611, 23021, 23029, 23203, 29207, 29411, 30203, 30211, 30307, 30323, 30341, 30347, 30389, 30529, 30703, 30707, 32029, 32141, 32143, 32303, 32321, 32323, 32341, 32503, 32507, 32561, 32941, 32983, 34123, 34129, 34141, 34147, 34303, 34703, 34747, 34949, 38303, 38321, 38329, 38561, 38567, 38921, 38923

Let's take the final number, \( \textbf{38923} \), above as an example. We have:$$ \begin{align} 3 + 8 &=11\\8 + 9 &= 17 \\ 9+2 &=11\\2+3 &=5 \end{align}$$We can add an additional constraint here and that is that the \( \textbf{first and last digits} \) be considered adjacent and prime as well. In this case, the suitable numbers in the range up to 40000 shrink to 60. These numbers belong to OEIS A086244 (permalink):$$ \begin{align} &\textbf{primes with the sums of all pairs of successive } \\  &\textbf{digits prime as well as sums of first and last digits} \end{align}$$11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 211, 2029, 2111, 2129, 2141, 2143, 2161, 2341, 2383, 2389, 2503, 2521, 4111, 4129, 4349, 4703, 4943, 6121, 6521, 6761, 8329, 8389, 8923, 8929, 11161, 11411, 12161, 12941, 14321, 14341, 14741, 16111, 16141, 16561, 16741, 20323, 20341, 20389, 20521, 20743, 20749, 21121, 21143, 21149, 21211, 21611, 23021, 23029, 23203, 29411

Let's take the final number in the previous list, \( \textbf{29411} \), and show that it satisfies the criteria:$$ \begin{align} 2 + 9 &= 11 \\ 9 + 4 &= 13 \\ 4 + 1 &= 5 \\ 1 + 1 &= 2 \\ 2 + 1 &= 3 \end{align}$$We can also consider primes where the absolute values of \( \textbf{differences} \) between successive pairs of digits are prime. There are 272 of these in the range up to 40000. They constitute OEIS A087593 (permalink):$$ \begin{align} &\textbf{primes with the absolute differences} \\  &\textbf{of all pairs of successive digits prime} \end{align} $$13, 29, 31, 41, 47, 53, 61, 79, 83, 97, 131, 149, 163, 181, 241, 257, 307, 313, 353, 383, 461, 463, 479, 503, 613, 631, 641, 647, 683, 727, 757, 797, 853, 857, 863, 929, 941, 947, 1303, 1307, 1361, 1381, 1427, 1429, 1613, 1697, 1831, 1861, 2027, 2029, 2053, 2503, 2531, 2579, 2707, 2729, 2741, 2749, 2753, 2797, 2927, 2963, 2969, 3079, 3163, 3169, 3181, 3527, 3529, 3581, 3583, 3613, 3631, 3697, 3853, 3863, 4241, 4253, 4297, 4649, 4703, 4729, 4969, 5279, 5297, 5303, 5381, 5741, 5749, 5813, 5857, 5861, 5869, 6131, 6163, 6353, 6361, 6427, 6469, 6857, 6863, 6869, 6947, 6949, 6961, 7027, 7057, 7079, 7207, 7247, 7253, 7297, 7507, 7529, 7583, 7927, 7949, 7963, 8147, 8161, 8353, 8363, 8369, 8527, 8581, 8641, 8647, 8681, 9203, 9241, 9257, 9413, 9461, 9463, 9479, 9497, 9613, 9631, 9649, 9697, 9749, 13147, 13163, 13183, 13613, 13649, 13681, 13697, 13831, 14149, 14207, 14249, 14683, 14741, 14747, 14753, 14797, 14929, 14947, 14969, 16141, 16183, 16361, 16363, 16369, 16381, 16427, 16831, 16927, 16963, 16979, 18131, 18149, 18169, 18181, 18307, 18313, 18353, 18503, 18583, 20249, 20297, 20353, 20357, 20369, 20507, 20707, 20747, 20749, 20753, 24169, 24181, 24203, 24247, 24631, 24683, 24697, 24749, 24979, 25031, 25057, 25247, 25253, 25303, 25307, 25357, 25703, 25741, 25747, 27031, 27241, 27253, 27427, 27479, 27527, 27529, 27581, 27583, 27941, 27947, 27961, 29207, 29297, 29429, 29641, 29683, 29741, 29753, 30203, 30241, 30253, 30307, 30313, 30529, 30703, 30707, 30727, 30757, 31307, 31357, 31469, 31649, 35027, 35053, 35257, 35279, 35353, 35363, 35381, 35729, 35747, 35753, 35797, 35831, 35863, 35869, 36131, 36161, 36307, 36313, 36353, 36383, 36469, 36479, 36497, 36857, 36929, 36947, 36979, 38149, 38183, 38303

Let's take the last number, \( \textbf{38303}\), in the list above. We have:$$ \begin{align} |3-8|=5 \\ |8 - 3|=5 \\ |3-0|=3 \\ |0-3|=3 \end{align}$$There are all sorts of variations on this theme (the properties of pairs of adjacent digits) and so another approach is to consider the squares of the digits. Let's require that the sums of squares of adjacent digits be prime. We find that there are 71 numbers that qualify in the range up to 40000. These are (permalink):$$ \begin{align} \textbf{primes with the sums of all pairs}\\ \textbf{of successive digits squared prime} \end{align} $$11, 23, 41, 61, 83, 127, 149, 211, 383, 521, 523, 541, 587, 727, 787, 941, 1123, 2111, 2141, 2161, 2383, 2521, 2549, 4111, 4127, 4523, 4549, 4561, 4583, 6121, 6521, 7211, 8387, 8521, 8527, 8783, 11149, 11161, 11411, 12149, 12161, 12323, 12527, 12541, 12583, 12721, 14149, 14549, 14561, 16111, 16127, 16141, 16561, 21121, 21149, 21211, 21611, 25411, 27211, 32141, 32321, 32323, 32327, 32561, 32587, 32783, 38321, 38327, 38561, 38723, 38783

Let's take the last number, \( \textbf{38783} \), as an example:$$ \begin{align} 3^2+8^2 &= 9 + 64 =73 \\ 8^2+7^2 &= 64 +49 = 113 \\ 7^2+8^2 &= 49+64 = 113 \\ 8^2+3^2 &= 64 + 9 = 73 \end{align}$$

Monday, 18 August 2025

Zumkeller Numbers

 I've been thinking about Zumkeller numbers. Here's a definition:

A number is a Zumkeller number if its divisors can be split into two separate sets that have the same sum. A key requirement for this to be possible is that the total sum of all divisors must be an even number. If the total sum were odd, you couldn't possibly split it into two equal integer sums.

Now the great majority of Zumkeller numbers are \( \textbf{even} \) numbers. In the range up to 100,000 there are 24362, comprising 24.362% of the range. However, there are only 208 \( \textbf{odd} \) Zumkeller numbers in that range, comprising 0.208%. It is suspected that every abundant number with an even sum of divisors is a Zumkeller number but this has not been proven. Any counterexample would have to be enormous—current searches have shown that if one exists, it must be greater than \(2×10^{13}\).

Now how many abundant numbers are \( \textbf{not} \) Zumkeller number because their sum of divisors is \( \textbf{odd} \)? In the range up to 100,000, there are 229 such numbers comprising OEIS A156903:

18, 36, 72, 100, 144, 162, 196, 200, 288, 324, 392, 400, 450, 576, 648, 784, 800, 882, 900, 968, 1152, 1296, 1352, 1458, 1568, 1600, 1764, 1800, 1936, 2178, 2304, 2450, 2500, 2592, 2704, 2916, 3042, 3136, 3200, 3528, 3600, 3872, 4050, 4356, 4608, 4624, 4900, 5000, 5184, 5202, 5408, 5776, 5832, 6050, 6084, 6272, 6400, 6498, 7056, 7200, 7744, 7938, 8100, 8450, 8464, 8712, 9216, 9248, 9522, 9604, 9800, 10000, 10368, 10404, 10816, 11025, 11250, 11552, 11664, 12100, 12168, 12544, 12800, 12996, 13122, 13456, 14112, 14400, 15138, 15376, 15488, 15876, 16200, 16900, 16928, 17298, 17424, 18432, 18496, 19044, 19208, 19600, 19602, 20000, 20736, 20808, 21632, 22050, 22500, 23104, 23328, 23716, 24200, 24336, 24642, 25088, 25600, 25992, 26244, 26912, 27378, 28224, 28800, 28900, 30258, 30276, 30752, 30976, 31752, 32400, 33124, 33282, 33800, 33856, 34596, 34848, 36100, 36450, 36864, 36992, 38088, 38416, 39200, 39204, 39762, 40000, 41472, 41616, 43218, 43264, 43808, 44100, 45000, 46208, 46656, 46818, 47432, 48400, 48672, 49284, 50176, 50562, 51200, 51984, 52488, 52900, 53792, 53824, 54450, 54756, 56448, 56644, 57600, 57800, 58482, 59168, 60516, 60552, 61250, 61504, 61952, 62500, 62658, 63504, 64800, 66248, 66564, 66978, 67600, 67712, 69192, 69696, 70688, 70756, 71442, 72200, 72900, 73728, 73984, 76050, 76176, 76832, 78400, 78408, 79524, 80000, 80802, 81796, 82944, 83232, 84100, 85698, 86436, 86528, 87616, 88200, 89888, 90000, 90738, 92416, 93312, 93636, 94864, 95922, 96100, 96800, 97344, 98568, 99225

Of the above, 227 are even with only two numbers being odd. These are 11025 and 99225:

  • \(11025 = 3^2 \times 5^2 \times 7^2 = 105^2\)
  • \(99225 = 3^4 \times 5^2 \times 7^2\ = 945^2 \)
Even 70, the smallest "weird number" (an abundant number that is not the sum of any subset of its proper divisors), is a Zumkeller number. It's sum of divisors is 144 > 140 and thus it is abundant. It's divisors are {1, 2, 5, 7, 10, 14, 35, 70}. These can be split into {70, 2} and {1, 5, 7, 10, 14, 35} with both summing to 72. In fact, up to 100,000 at least, \( \text{all}\) of the weird numbers are Zumkeller numbers. Here are the weird numbers up to 100,000:

70, 836, 4030, 5830, 7192, 7912, 9272, 10430, 10570, 10792, 10990, 11410, 11690, 12110, 12530, 12670, 13370, 13510, 13790, 13930, 14770, 15610, 15890, 16030, 16310, 16730, 16870, 17272, 17570, 17990, 18410, 18830, 18970, 19390, 19670, 19810, 20510, 21490, 21770, 21910, 22190, 23170, 23590, 24290, 24430, 24710, 25130, 25690, 26110, 26530, 26810, 27230, 27790, 28070, 28630, 29330, 29470, 30170, 30310, 30730, 31010, 31430, 31990, 32270, 32410, 32690, 33530, 34090, 34370, 34930, 35210, 35630, 36470, 36610, 37870, 38290, 38990, 39410, 39830, 39970, 40390, 41090, 41510, 41930, 42070, 42490, 42910, 43190, 43330, 44170, 44870, 45010, 45290, 45356, 45710, 46130, 46270, 47110, 47390, 47810, 48370, 49070, 49630, 50330, 50890, 51310, 51730, 52010, 52570, 52990, 53270, 53830, 54110, 55090, 55790, 56630, 56770, 57470, 57610, 57890, 58030, 58730, 59710, 59990, 60130, 60410, 61390, 61670, 61810, 62090, 63490, 63770, 64330, 65030, 65590, 65870, 66290, 66710, 67690, 67970, 68390, 68810, 69370, 69790, 70630, 70910, 71330, 71470, 72170, 72310, 72730, 73430, 73570, 73616, 74270, 74410, 74830, 76090, 76370, 76510, 76790, 77210, 77630, 78190, 78610, 79030, 80570, 80710, 81410, 81970, 82670, 83090, 83312, 83510, 84070, 84910, 85190, 85610, 86030, 86170, 86590, 87430, 88130, 89390, 89530, 89810, 90230, 90370, 90790, 91070, 91210, 91388, 91490, 92330, 92470, 92890, 95270, 95690, 96110, 96670, 97930, 98630, 99610, 99890

I've only written about Zumkeller numbers on one previous occasion. That was a post titled Zumkellar Numbers, Half Zumkellar Numbers and Pseudoperfect Numbers that I uploaded in November of 2018. In that post I made reference to the person behind these numbers by quoting a eulogy by Neil Sloane, the originator of the OEIS.
I am deeply sorry to have to report that Reinhard Zumkeller passed away at the end of March 2016. He suffered from pancreatic cancer, which had already progressed to an advanced stage when it was diagnosed. He was a long-time contributor to the OEIS, and was later an editor and then a diligent and dedicated editor-in-chief. Between 2000 and 2016 he contributed over 23000 items to the OEIS. Reinhard was a great Haskell expert, and he was already ready to write a Haskell program and compute 10000 terms when I was studying a new sequence and wanted to see a graph. He will be greatly missed. Neil Sloane, July 3, 2016.

Thursday, 14 August 2025

Coding and Integers

The thought struck me to write a program that looked at all base 10 numbers in the range from 10 to 40000 that, when converted to a number base between 2 and 9, returned a number with the same digits as the base 10 number but in a different order. It's a simple enough program to write in SageMath and this is what I created originally:

T=[("number","permutation","base")]
T.append(("","",""))
for n in [10..40000]:
    for b in [2..9]:
        number=int(n.str(base=b))
        if sorted(n.digits())==sorted(number.digits()):
            L.append(n)
            T.append((n,n.str(base=b),b))
print(L)
print(len(L))
print()
print(table(T))

The program will not run because there is a problem with "sorted(number.digits())". I get the error message "AttributeError: 'int' object has no attribute 'digits' ". I know from experience how to fix the problem. I simply replace "int" with "Integer" but I've never fully understood why this change is necessary. I queried Gemini and it came up with the following explanation:

Of course. Your code requires SageMath's Integer type because it uses special mathematical methods that Python's standard int type doesn't have.

The specific line of code that causes the issue is if sorted(n.digits())==sorted(number.digits()):.


SageMath's Integer vs. Python's int

Think of Python's built-in int as a basic calculator and SageMath's Integer as a powerful scientific calculator. While both can store whole numbers, the SageMath version comes with a lot of extra functions built specifically for number theory and advanced mathematics.

Python int: A standard data type for storing whole numbers. It's great for general programming, loops, and basic arithmetic. However, it does not have a built-in method called .digits().
SageMath Integer: A more specialized object. It's designed for mathematical computation and has many useful methods, including:
.digits(): Returns a list of the number's digits.
.str(base=b): Returns the string representation of the number in a given base.
.is_prime(): Checks if the number is prime.
.divisors(): Returns a list of the number's divisors.

Why Your Code Fails with int

In your loop, the variable n is a SageMath Integer because it's created by SageMath's range notation ([10..40000]).
When you write number = int(n.str(base=b)), you successfully convert the base-b string representation of n into a standard Python int and store it in the number variable.
The program then fails at the next line: sorted(number.digits()). Since number is a plain Python int, it doesn't have the .digits() method, and SageMath throws an AttributeError.

Why Your Code Works with Integer

When you use number = Integer(n.str(base=b)), you are using SageMath's Integer constructor.
This creates a SageMath Integer object and stores it in the number variable.
Now, when the program reaches sorted(number.digits()), the call is valid because SageMath Integer objects do have the .digits() method. 👍

In short, you must use Integer to ensure that both n and number are SageMath objects that understand the special mathematical methods your algorithm relies on.

So now I know. So what is the output from my program when it is run? It turns out that there are 76 numbers that satisfy and they are (permalink):

13, 23, 46, 158, 227, 265, 316, 445, 1030, 1045, 1135, 1234, 1236, 1273, 1366, 1380, 1431, 1454, 1653, 2027, 2060, 2116, 2154, 2315, 2534, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3226, 5270, 5567, 5637, 5783, 10144, 10235, 10342, 10453, 10542, 11425, 11750, 12415, 12450, 12564, 12651, 13045, 13245, 13260, 13402, 13534, 13620, 14610, 15226, 15643, 16255, 16273, 16546, 16633, 21322, 21753, 21763, 21835, 23568, 26804, 30576, 31457, 32348, 34582, 35001, 35081, 35228, 37465

These numbers are the initial members of OEIS A090144 (I've discounted the trivial numbers from 1 to 8). Here are the details:

  number   permutation   base
  13       31            4
  23       32            7
  46       64            7
  158      185           9
  227      272           9
  265      526           7
  316      631           7
  445      544           9
  1030     3001          7
  1045     4501          6
  1135     5131          6
  1234     3412          7
  1236     1623          9
  1273     2371          8
  1366     3661          7
  1380     1803          9
  1431     4113          7
  1454     4145          7
  1653     3165          8
  2027     2702          9
  2060     6002          7
  2116     6112          7
  2154     4152          8
  2315     3152          9
  2534     3425          9
  3160     6130          8
  3161     6131          8
  3162     6132          8
  3163     6133          8
  3164     6134          8
  3165     6135          8
  3166     6136          8
  3167     6137          8
  3226     6232          8
  5270     7205          9
  5567     7565          9
  5637     7653          9
  5783     7835          9
  10144    41401         7
  10235    15032         9
  10342    42103         7
  10453    15304         9
  10542    42510         7
  11425    45211         7
  11750    17105         9
  12415    51124         7
  12450    51204         7
  12564    51426         7
  12651    51612         7
  13045    53014         7
  13245    53421         7
  13260    20163         9
  13402    20341         9
  13534    54313         7
  13620    20613         9
  14610    60411         7
  15226    62251         7
  15643    63415         7
  16255    65251         7
  16273    37621         8
  16546    66145         7
  16633    66331         7
  21322    32221         9
  21753    52371         8
  21763    32761         9
  21835    32851         9
  23568    35286         9
  26804    40682         9
  30576    73560         8
  31457    75341         8
  32348    48332         9
  34582    52384         9
  35001    53010         9
  35081    53108         9
  35228    53282         9
  37465    56347         9