Showing posts with label prime numbers. Show all posts
Showing posts with label prime numbers. Show all posts

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}$$

Friday, 2 May 2025

A Variation on the Descent to Zero

In my post on the 23rd of April 2025 titled Descent to Zero, I considered the smallest numbers that take a certain number of steps to reach 0 under "\(k \rightarrow \) max product of two numbers whose concatenation is \(k\)". What happens if we change this slightly so that the rule is now "\(k \rightarrow \) max product of two \( \textbf{prime} \) numbers whose concatenation is \(k\)".

This is highly restrictive because only numbers that can be split into a pair of prime numbers in one or more ways are eligible for consideration. For example, 246 is dismissed but 235 is eligible for consideration because it can be split into 23 x 5. Moreover, the process of splitting into primes needs to continue until zero is reached if the number is to be a candidate for the smallest number. Here are the numbers that require from 1 to 9 steps to reach zero:$$1, 22, 55, 115, 235, 475, 3389, 13457, 35743$$The breakdown is as follows:

  • Descent of 9 steps to zero: 35743 --> 17229, 3893, 1167, 737, 511, 55, 25, 10, 0
  • Descent of 8 steps to zero: 13457 --> 5941, 4705, 235, 115, 55, 25, 10, 0
  • Descent of 7 steps to zero: 3389 --> 1167, 737, 511, 55, 25, 10, 0
  • Descent of 6 steps to zero: 475 --> 235, 115, 55, 25, 10, 0
  • Descent of 5 steps to zero: 235 --> 115, 55, 25, 10, 0
  • Descent of 4 steps to zero: 115 --> 55, 25, 10, 0
  • Descent of 3 steps to zero: 55 --> 25, 10, 0
  • Descent of 2 steps to zero: 22 --> 4, 0
  • Descent of 1 step to zero: 1 --> 0
The convention is that single digits or 10 get mapped to zero. Let's look at how 35743 reaches zero:$$ \begin{align} 35743 &\rightarrow 3 \times 5743 = 17229\\17229 &\rightarrow 17 \times 229 = 5743\\5743 &\rightarrow 5 \times 743 = 3893\\ 3893 &\rightarrow 389 \times 3 = 1167\\1167 &\rightarrow 11 \times 67  = 737\\737 &\rightarrow 73 \times 7 = 511\\511 &\rightarrow 5 \times 11 = 55\\55 &\rightarrow 5 \times 5 = 25\\25 &\rightarrow 2 \times 5 = 10\\10 &\rightarrow 0 \end{align}$$Note that other prime number products are possible. For example 5743 could be split into 57 x 43 but this is smaller than 5 x 5743. Similarly, 737 could be split into 7 x 37 but again this is smaller than 73 x 7.

There are in fact only 127 numbers in the range from 11 to 40000 that can be reduced down to 10 or a single digit. They are (permalink) with record breakers shown in red:

22, 23, 25, 32, 33, 52, 55, 112, 113, 115, 202, 203, 205, 211, 235, 297, 302, 303, 311, 415, 475, 502, 505, 511, 523, 541, 547, 583, 729, 737, 773, 835, 1012, 1013, 1015, 1102, 1103, 1105, 1153, 1167, 1512, 1675, 2002, 2003, 2005, 2011, 2101, 2151, 2251, 2305, 2512, 3002, 3003, 3011, 3101, 3389, 3893, 4015, 4105, 4437, 4615, 4705, 5002, 5005, 5011, 5023, 5041, 5047, 5083, 5101, 5167, 5401, 5461, 5821, 5941, 6711, 7029, 7073, 7171, 7443, 8215, 8305, 9415, 10102, 10103, 10105, 10171, 11002, 11003, 11005, 11053, 11067, 11191, 11491, 11643, 12743, 13457, 14537, 15102, 16705, 17229, 19111, 20002, 20003, 20005, 20011, 20101, 20151, 20251, 23005, 24183, 25051, 25102, 25501, 29659, 30002, 30003, 30011, 30101, 30389, 31971, 32237, 33881, 35743, 36437, 38813, 38903

This permalink will allow you to enter any of the above numbers and receive as output the descent of the number to 10 or a single digit. For example, entering the number 38903 produces the following output:
Starting with: 38903
Dividing 38903 into prime parts and multiplying gives: 1167
Dividing 1167 into prime parts and multiplying gives: 737
Dividing 737 into prime parts and multiplying gives: 511
Dividing 511 into prime parts and multiplying gives: 55
Dividing 55 into prime parts and multiplying gives: 25
Dividing 25 into prime parts and multiplying gives: 10
Reached: 10

Sunday, 3 September 2023

Some Very Special Sphenic Numbers

Today, having turned 27181 days old and also 3883 weeks old, I discovered that 27181 is a very special number indeed. It is a sphenic number with the property that when its three prime factors are concatenated in any order, the resultant numbers are all prime. The details are as follows:$$27181=7 \times 11 \times 353\\ \text{with the concatenated numbers thus being}\\711353, 735311, 117353, 113537, 353711, 353117$$In my long journey to this numbered day, there has only been one previous numbered day and that was 3311. Its details are as follows:$$3311=7 \times 11 \times 43\\\text{with the concatenated numbers thus being}\\71143, 74311, 11743, 11437, 43711, 43117$$In my long journey from womb to tomb, I'm only likely to encounter one further such numbered day and that is 32153. Its details are:$$ 32153=11 \times 37 \times 79\\ \text{with the concatenated numbers thus being}\\113779, 117937, 371179, 377911, 791137, 793711$$That numbered day falls on Tuesday, April 14th 2037 and I may or may not make it that far. It is shortly after my 88th birthday.

My special sphenic numbers are
3311, 27181 and 32153

The other numbers up to one million are 41237, 53977, 86507, 110971, 125069, 208579, 256413, 500981, 543337, 853811, 901949 and 964481. The OEIS comments state that, for quadruply composite numbers, is no term with four distinct prime factors under one hundred million.

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.

Monday, 13 March 2023

Rectangles and Squares

If we envisage a semiprime that is not a square number as a rectangle then a number like 15 that is equal to 3 x 5 could be represented as shown in Figure 1:


Figure 1: created using Geoboard

The average of 3 and 5 is 4 and a 4 x 4 square has the same perimeter as the 3 x 5 rectangle. Both are 16 units in perimeter. See Figure 2.


Figure 2: created using Geoboard

Though the rectangle and the square have the same perimeter, they have different areas. The rectangle has an area of 15 square units and the square has an area of 16 square units. 16 is a square number and the semiprime 15 is linked to it via its two prime factors:$$\frac{3 +5}{2} \times 4 = 16$$The square number divided by 4 gives the side of the associated square. Not every semiprime can be linked to square number in this way. Take 33 with prime factors of 3 and 11 as an example:$$\frac{3 +11}{2} \times 4 = 28$$In general, if a semiprime has two distinct prime factors \(a\) and \(b\), then the condition is that \(2 \times (a+b) \) needs to be a square number. 

In the range up to 40,000, only 172 of the 9790 semiprimes qualify (permalink). Here is the list:
15, 65, 77, 87, 141, 247, 301, 335, 481, 589, 591, 671, 717, 767, 785, 1007, 1167, 1247, 1271, 1351, 1415, 1501, 1527, 1661, 1937, 1967, 2071, 2077, 2157, 2257, 2317, 2391, 2977, 3007, 3047, 3101, 3197, 3215, 3439, 3997, 4061, 4087, 4237, 4385, 4487, 4607, 4829, 4927, 5111, 5777, 6031, 6077, 6161, 6487, 6497, 6541, 6557, 6751, 6927, 7087, 7265, 7341, 7357, 7361, 7967, 8189, 8479, 8557, 9217, 9271, 9287, 9517, 9991, 10077, 10157, 10231, 10727, 11041, 11327, 12209, 12687, 12877, 12989, 13511, 13847, 14317, 14397, 15007, 15185, 15917, 16081, 16397, 16769, 16897, 16957, 17711, 17951, 18141, 18157, 18527, 18807, 19117, 19127, 19367, 19511, 19679, 19741, 19757, 20017, 20191, 20567, 20687, 20711, 20877, 21041, 21421, 21697, 23015, 23231, 23377, 23389, 23729, 23839, 24727, 24737, 24887, 24961, 25341, 25661, 25837, 25967, 25985, 26797, 26909, 27341, 27661, 28247, 28417, 29047, 29135, 29431, 30237, 30311, 30461, 30847, 31597, 31681, 32047, 32551, 32567, 32847, 33527, 34207, 34241, 34647, 34951, 35249, 35741, 35807, 36077, 36391, 36737, 37327, 37437, 37777, 38081, 38191, 38407, 38551, 38687, 39421, 39665
Let's test the second member of the sequence, 65, with factors of 5 and 13. We see that:$$2 \times (5+13)=36$$The associated square has a side of 9 units. However, different semiprimes can produce the same square number. Take the semiprime 77 with prime factors of 7 and 11 as an example: $$2 \times (7+11)=36$$See Figure 3 where the two rectangles associated with the two different semiprimes are shown together with the associated square.


Figure 3: created using Geoboard

If we want to work backwards from the square numbers to the semiprimes, then it's a question of dividing the square number by 2 and partitioning the resultant number into two parts such that each is prime. The results (permalink) are shown in the table below with only those semiprimes up to 40,000 displayed. The algorithm is easily modified so as to remove this filter and show all semiprimes associated with square numbers up and including 40,000.

square   half-square   rectangle    semiprime

  16       8             [5, 3]       15
  36       18            [13, 5]      65
  36       18            [11, 7]      77
  64       32            [29, 3]      87
  64       32            [19, 13]     247
  100      50            [47, 3]      141
  100      50            [43, 7]      301
  100      50            [37, 13]     481
  100      50            [31, 19]     589
  144      72            [67, 5]      335
  144      72            [61, 11]     671
  144      72            [59, 13]     767
  144      72            [53, 19]     1007
  144      72            [43, 29]     1247
  144      72            [41, 31]     1271
  196      98            [79, 19]     1501
  196      98            [67, 31]     2077
  196      98            [61, 37]     2257
  256      128           [109, 19]    2071
  256      128           [97, 31]     3007
  256      128           [67, 61]     4087
  324      162           [157, 5]     785
  324      162           [151, 11]    1661
  324      162           [149, 13]    1937
  324      162           [139, 23]    3197
  324      162           [131, 31]    4061
  324      162           [109, 53]    5777
  324      162           [103, 59]    6077
  324      162           [101, 61]    6161
  324      162           [89, 73]     6497
  324      162           [83, 79]     6557
  400      200           [197, 3]     591
  400      200           [193, 7]     1351
  400      200           [181, 19]    3439
  400      200           [163, 37]    6031
  400      200           [157, 43]    6751
  400      200           [139, 61]    8479
  400      200           [127, 73]    9271
  400      200           [103, 97]    9991
  484      242           [239, 3]     717
  484      242           [229, 13]    2977
  484      242           [223, 19]    4237
  484      242           [211, 31]    6541
  484      242           [199, 43]    8557
  484      242           [181, 61]    11041
  484      242           [163, 79]    12877
  484      242           [139, 103]   14317
  576      288           [283, 5]     1415
  576      288           [281, 7]     1967
  576      288           [277, 11]    3047
  576      288           [271, 17]    4607
  576      288           [269, 19]    5111
  576      288           [257, 31]    7967
  576      288           [251, 37]    9287
  576      288           [241, 47]    11327
  576      288           [229, 59]    13511
  576      288           [227, 61]    13847
  576      288           [199, 89]    17711
  576      288           [191, 97]    18527
  576      288           [181, 107]   19367
  576      288           [179, 109]   19511
  576      288           [157, 131]   20567
  576      288           [151, 137]   20687
  576      288           [149, 139]   20711
  676      338           [331, 7]     2317
  676      338           [307, 31]    9517
  676      338           [277, 61]    16897
  676      338           [271, 67]    18157
  676      338           [241, 97]    23377
  676      338           [229, 109]   24961
  676      338           [211, 127]   26797
  676      338           [199, 139]   27661
  676      338           [181, 157]   28417
  784      392           [389, 3]     1167
  784      392           [379, 13]    4927
  784      392           [373, 19]    7087
  784      392           [349, 43]    15007
  784      392           [331, 61]    20191
  784      392           [313, 79]    24727
  784      392           [283, 109]   30847
  784      392           [241, 151]   36391
  784      392           [229, 163]   37327
  784      392           [211, 181]   38191
  784      392           [199, 193]   38407
  900      450           [443, 7]     3101
  900      450           [439, 11]    4829
  900      450           [433, 17]    7361
  900      450           [431, 19]    8189
  900      450           [421, 29]    12209
  900      450           [419, 31]    12989
  900      450           [409, 41]    16769
  900      450           [397, 53]    21041
  900      450           [389, 61]    23729
  900      450           [383, 67]    25661
  900      450           [379, 71]    26909
  900      450           [367, 83]    30461
  900      450           [353, 97]    34241
  900      450           [349, 101]   35249
  900      450           [347, 103]   35741
  900      450           [337, 113]   38081
  1024     512           [509, 3]     1527
  1024     512           [499, 13]    6487
  1024     512           [439, 73]    32047
  1024     512           [433, 79]    34207
  1156     578           [571, 7]     3997
  1156     578           [547, 31]    16957
  1156     578           [541, 37]    20017
  1156     578           [499, 79]    39421
  1296     648           [643, 5]     3215
  1296     648           [641, 7]     4487
  1296     648           [631, 17]    10727
  1296     648           [619, 29]    17951
  1296     648           [617, 31]    19127
  1296     648           [607, 41]    24887
  1296     648           [601, 47]    28247
  1296     648           [587, 61]    35807
  1444     722           [719, 3]     2157
  1444     722           [709, 13]    9217
  1444     722           [691, 31]    21421
  1600     800           [797, 3]     2391
  1600     800           [787, 13]    10231
  1600     800           [769, 31]    23839
  1600     800           [757, 43]    32551
  1764     882           [877, 5]     4385
  1764     882           [863, 19]    16397
  1764     882           [859, 23]    19757
  1764     882           [853, 29]    24737
  1764     882           [839, 43]    36077
  1936     968           [937, 31]    29047
  2116     1058          [1051, 7]    7357
  2116     1058          [1039, 19]   19741
  2116     1058          [1021, 37]   37777
  2304     1152          [1129, 23]   25967
  2304     1152          [1123, 29]   32567
  2500     1250          [1237, 13]   16081
  2500     1250          [1231, 19]   23389
  2916     1458          [1453, 5]    7265
  2916     1458          [1451, 7]    10157
  2916     1458          [1447, 11]   15917
  2916     1458          [1439, 19]   27341
  3136     1568          [1549, 19]   29431
  3364     1682          [1669, 13]   21697
  3364     1682          [1663, 19]   31597
  3600     1800          [1789, 11]   19679
  3600     1800          [1787, 13]   23231
  3600     1800          [1783, 17]   30311
  4096     2048          [2029, 19]   38551
  4356     2178          [2161, 17]   36737
  4624     2312          [2309, 3]    6927
  4900     2450          [2447, 3]    7341
  4900     2450          [2437, 13]   31681
  5184     2592          [2579, 13]   33527
  5476     2738          [2731, 7]    19117
  6084     3042          [3037, 5]    15185
  6724     3362          [3359, 3]    10077
  7056     3528          [3517, 11]   38687
  7396     3698          [3691, 7]    25837
  8464     4232          [4229, 3]    12687
  9216     4608          [4603, 5]    23015
  9604     4802          [4799, 3]    14397
  10000    5000          [4993, 7]    34951
  10404    5202          [5197, 5]    25985
  11664    5832          [5827, 5]    29135
  12100    6050          [6047, 3]    18141
  12544    6272          [6269, 3]    18807
  13924    6962          [6959, 3]    20877
  15876    7938          [7933, 5]    39665
  16900    8450          [8447, 3]    25341
  20164    10082         [10079, 3]   30237
  21904    10952         [10949, 3]   32847
  23104    11552         [11549, 3]   34647
  24964    12482         [12479, 3]   37437

One could extend this idea to sphenic numbers and three dimensions. Each sphenic number can be interpreted as a brick or rectangular prism. What sphenic numbers have surface areas that are the same as that of cubes with integer sides? The list of such sphenic numbers is shown in the table below (permalink):

sphenic   factors         SA      cube side   SA

  374       2 * 11 * 17     486     9           486
  710       2 * 5 * 71      1014    13          1014
  3110      2 * 5 * 311     4374    27          4374
  3590      2 * 5 * 359     5046    29          5046
  4454      2 * 17 * 131    5046    29          5046
  6182      2 * 11 * 281    7350    35          7350
  7190      2 * 5 * 719     10086   41          10086
  8911      7 * 19 * 67     3750    25          3750
  9494      2 * 47 * 101    10086   41          10086
  10502     2 * 59 * 89     11094   43          11094
  10507     7 * 19 * 79     4374    27          4374
  11798     2 * 17 * 347    13254   47          13254
  18518     2 * 47 * 197    19494   57          19494
  18854     2 * 11 * 857    22326   61          22326
  20390     2 * 5 * 2039    28566   69          28566
  24134     2 * 11 * 1097   28566   69          28566
  27559     7 * 31 * 127    10086   41          10086

Thursday, 9 February 2023

In the Vicinity of Cubic Numbers

In searching for properties of the number associated with my diurnal age, 26975, I noticed that the difference between this number and the nearest cubic number is 25 and that 25 divides 27000 (the nearest cubic number) to give 1080. I got to thinking about how many numbers, in the range up to 40,000, have this property.

Well, it turns out that 711 numbers do. A list of them is included at the end of this post. These numbers are not evenly distributed. They tend to cluster around cubic numbers with a large number of divisors and are sparsest around cubic numbers that are the cubes of primes. Figure 1 shows a list of the numbers from 1 to 35, together with their cubes and the numbers of both their divisors.


Figure 1: permalink

The graph of the 711 numbers is interesting, displaying a sinuous pattern. See Figure 2.


Figure 2: permalink

If we zoom in, things become clearer. Let's consider the cubic number 27000 that is the cube of 30. The former has 8 divisors and the latter 64. We'll look at the range from 26000 to 28000. Figure 3 shows the plot of the 94 numbers that qualify.


Figure 3: permalink

Notice how the graph is the same shape as that of \(y=x^3\). Next look at the cubic number 29791 that is the cube of 31. The former has four divisors (1, 31, 31 x 31 and 31 x 31 x 31) while the latter has two (1 and 31). The plot is shown in Figure 4 for the range from 28791 to 30791.


Figure 4: permalink

There are only six numbers and these are 28830, 29760, 29790, 29792, 29822, 30752. The numbers immediately preceding and succeeding the cubic number will always qualify since the difference is 1. Thus 26970 and 26972 are represented. Numbers with a difference of 31 will qualify and thus 26760 and 29822 are represented. Numbers with a difference of 31 x 31 will qualify and thus 28830 and 30752 are represented.

An interesting fact is that is that the difference not only divides the cubic number, it also always divides the number itself. For example, in the case 26975, the difference of 25 between 26975 and 27000 also divides 26975. To see why this is so, let's consider a cubic number \(c^3\) and a number \(n<c^3\) such that:
$$ 

\begin{align} \frac{c^3}{c^3-n} = k \text{ with integer }k>0\\

kc^3-kn =c^3\\

kn=kc^3-c^3\\

kn=c^3(k-1)\\

n=\dfrac{c^3}{k} (k-1) \\

n= \text{ difference } \times (k-1) \end{align}
$$Hence \(n\) is always divisible by the difference. Take \(n=26975\) as an example. $$ \begin{align} \frac{27000}{25} &=1080\\26975=25 \times (1080-1) &=25 \times 1079 \end{align}$$A similar proof can be concocted for the case where \(n>c^3\). Here is the list of the 711 numbers (permalink).

2, 4, 6, 7, 9, 10, 12, 18, 24, 26, 28, 30, 36, 48, 56, 60, 62, 63, 65, 66, 68, 72, 80, 100, 120, 124, 126, 130, 150, 180, 189, 192, 198, 204, 207, 208, 210, 212, 213, 214, 215, 217, 218, 219, 220, 222, 224, 225, 228, 234, 240, 243, 252, 270, 294, 336, 342, 344, 350, 392, 448, 480, 496, 504, 508, 510, 511, 513, 514, 516, 520, 528, 544, 576, 648, 702, 720, 726, 728, 730, 732, 738, 756, 810, 875, 900, 950, 960, 975, 980, 990, 992, 995, 996, 998, 999, 1001, 1002, 1004, 1005, 1008, 1010, 1020, 1025, 1040, 1050, 1100, 1125, 1210, 1320, 1330, 1332, 1342, 1452, 1536, 1584, 1620, 1632, 1656, 1664, 1674, 1680, 1692, 1696, 1701, 1704, 1710, 1712, 1716, 1719, 1720, 1722, 1724, 1725, 1726, 1727, 1729, 1730, 1731, 1732, 1734, 1736, 1737, 1740, 1744, 1746, 1752, 1755, 1760, 1764, 1776, 1782, 1792, 1800, 1824, 1836, 1872, 1920, 1944, 2028, 2184, 2196, 2198, 2210, 2366, 2548, 2646, 2688, 2695, 2716, 2730, 2736, 2737, 2740, 2742, 2743, 2745, 2746, 2748, 2751, 2752, 2758, 2772, 2793, 2800, 2842, 2940, 3150, 3240, 3250, 3300, 3330, 3348, 3350, 3360, 3366, 3370, 3372, 3374, 3376, 3378, 3380, 3384, 3390, 3400, 3402, 3420, 3450, 3500, 3510, 3600, 3840, 3968, 4032, 4064, 4080, 4088, 4092, 4094, 4095, 4097, 4098, 4100, 4104, 4112, 4128, 4160, 4224, 4352, 4624, 4896, 4912, 4914, 4930, 5202, 5508, 5589, 5616, 5670, 5724, 5751, 5760, 5778, 5796, 5805, 5808, 5814, 5820, 5823, 5824, 5826, 5828, 5829, 5830, 5831, 5833, 5834, 5835, 5836, 5838, 5840, 5841, 5844, 5850, 5856, 5859, 5868, 5886, 5904, 5913, 5940, 5994, 6048, 6075, 6156, 6318, 6498, 6840, 6858, 6860, 6878, 7220, 7500, 7600, 7680, 7750, 7800, 7840, 7875, 7900, 7920, 7936, 7950, 7960, 7968, 7975, 7980, 7984, 7990, 7992, 7995, 7996, 7998, 7999, 8001, 8002, 8004, 8005, 8008, 8010, 8016, 8020, 8025, 8032, 8040, 8050, 8064, 8080, 8100, 8125, 8160, 8200, 8250, 8320, 8400, 8500, 8820, 8918, 9072, 9114, 9198, 9212, 9234, 9240, 9252, 9254, 9258, 9260, 9262, 9264, 9268, 9270, 9282, 9288, 9310, 9324, 9408, 9450, 9604, 9702, 10164, 10406, 10527, 10560, 10604, 10626, 10637, 10640, 10644, 10646, 10647, 10649, 10650, 10652, 10656, 10659, 10670, 10692, 10736, 10769, 10890, 11132, 11638, 12144, 12166, 12168, 12190, 12696, 13056, 13248, 13312, 13392, 13440, 13536, 13568, 13608, 13632, 13680, 13696, 13716, 13728, 13752, 13760, 13770, 13776, 13788, 13792, 13797, 13800, 13806, 13808, 13812, 13815, 13816, 13818, 13820, 13821, 13822, 13823, 13825, 13826, 13827, 13828, 13830, 13832, 13833, 13836, 13840, 13842, 13848, 13851, 13856, 13860, 13872, 13878, 13888, 13896, 13920, 13932, 13952, 13968, 14016, 14040, 14080, 14112, 14208, 14256, 14336, 14400, 14592, 14688, 15000, 15500, 15600, 15620, 15624, 15626, 15630, 15650, 15750, 16250, 16900, 17238, 17407, 17472, 17524, 17550, 17563, 17568, 17572, 17574, 17575, 17577, 17578, 17580, 17584, 17589, 17602, 17628, 17680, 17745, 17914, 18252, 18954, 19440, 19602, 19656, 19674, 19680, 19682, 19684, 19686, 19692, 19710, 19764, 19926, 20412, 21168, 21266, 21504, 21560, 21609, 21728, 21756, 21840, 21854, 21888, 21896, 21903, 21920, 21924, 21936, 21938, 21944, 21945, 21948, 21950, 21951, 21953, 21954, 21956, 21959, 21960, 21966, 21968, 21980, 21984, 22001, 22008, 22016, 22050, 22064, 22148, 22176, 22295, 22344, 22400, 22638, 22736, 23548, 24360, 24388, 24390, 24418, 25230, 25875, 25920, 26000, 26100, 26250, 26325, 26400, 26460, 26500, 26550, 26625, 26640, 26700, 26730, 26750, 26775, 26784, 26800, 26820, 26850, 26865, 26875, 26880, 26892, 26900, 26910, 26925, 26928, 26940, 26946, 26950, 26955, 26960, 26964, 26970, 26973, 26975, 26976, 26980, 26982, 26985, 26988, 26990, 26991, 26992, 26994, 26995, 26996, 26997, 26998, 26999, 27001, 27002, 27003, 27004, 27005, 27006, 27008, 27009, 27010, 27012, 27015, 27018, 27020, 27024, 27025, 27027, 27030, 27036, 27040, 27045, 27050, 27054, 27060, 27072, 27075, 27090, 27100, 27108, 27120, 27125, 27135, 27150, 27180, 27200, 27216, 27225, 27250, 27270, 27300, 27360, 27375, 27450, 27500, 27540, 27600, 27675, 27750, 27900, 28000, 28080, 28125, 28350, 28830, 29760, 29790, 29792, 29822, 30752, 31744, 32256, 32512, 32640, 32704, 32736, 32752, 32760, 32764, 32766, 32767, 32769, 32770, 32772, 32776, 32784, 32800, 32832, 32896, 33024, 33280, 33792, 34606, 34848, 35574, 35640, 35816, 35838, 35904, 35910, 35926, 35928, 35934, 35936, 35938, 35940, 35946, 35948, 35964, 35970, 36036, 36058, 36234, 36300, 37026, 37268, 38148, 38726, 39015, 39168, 39236, 39270, 39287, 39296, 39300, 39302, 39303, 39305, 39306, 39308, 39312, 39321, 39338, 39372, 39440, 39593, 39882

Friday, 12 November 2021

Ultramagic Squares

Here is a definition of an ultramagic square:

A magic square is associative if the sum of any two elements symmetric about its center is the same. A magic square is pandiagonal if the sum of the numbers in any broken diagonal equals the magic constant. A magic square is ultramagic if it is associative and pandiagonal. Ultramagic squares exist for orders n>=5. Source.

Using this as a starting point, let's understand what is meant by a pandiagonal magic square. Here is a definition taken from a most useful website:

Pandiagonal magic squares are magic squares, where also the broken diagonals sum to the magic constant. This means when you go off of one edge on a diagonal, continue (wrap-around) to the corresponding cell on the opposite edge. These squares are considered as one of the top classes of magic squares.

Figures 1 and 2 show clearly what is meant by a "broken diagonal" and show a 5 x 5 magic square that is pandiagonal. 


Figure 1


Figure 2

The magic square in Figures 1 and 2 however, is not associative. Using the central square (24) as a reference point, we note that, up-down 3 + 12 = 15 but left-right 20 + 6 = 26. These must be equal for a magic square to be associative. Figure 3 shows a 5 x 5 magic square that is both pandiagonal and associative, and thus ultramagic.

Figure 3

The magic constant for this square is 65 and it can be seen that all rows, columns, main diagonals and broken diagonals all add to this number. Furthermore, the up-down 6 + 20 = 26 and the left-right 2 + 24 = 26 are this time equal as are all the other symmetric pairs of elements.

Figure 3 shows a 7 x 7 ultramagic square:


Figure 4: source

Figures 5, 6 and 7 show 6 x 6, 7 x 7 and 8 x 8 prime ultramagic squares with magic constants of 990, 4613 and 2040 respectively:
Figure 5: source


Figure 6: source


Figure 8: source

These magic constants (990, 4613 and 2040) are the lowest possible and form part of OEIS A257316:


 A257316

Smallest magic constant of ultramagic squares of order \(n\) composed of distinct prime numbers.


The sequence runs 3505, 990, 4613, 2040 with 3505 being the magic constant (not shown) for the 5 x 5 ultramagic square with minimal magic constant. The following bounds for the next terms are known:
  • 12249 <=a(9) <=13059
  • 4200 <=a(10) <=46150
  • a(11) >= 26521
  • a(12) >= 8820
  • a(13) >= 49439
  • a(14) >= 16170
  • a(15) >= 74595
  • a(16) >= 21840
My attention was attracted to the topic because today I turned 26521 days old and this number happens to be the lower bound for the 11 x 11 prime ultramagic square with minimal magic constant. The exact composition of such a square is presumably still not known.

My earlier posts on Magic Squares are:

Monday, 23 August 2021

Recursion involving the Totient Function

With plenty of time on my hands and my mind being lately obsessed with recursive processes, I contemplated what might happen if I took a number and added its totient plus one to it, repeating the process with the new number and only terminating when a prime number was reached. Put mathematically and applied to a number \(n\), we have:$$n \rightarrow n+\phi(n)+1$$The first thing to realise is that for any prime number \(p\), this process will yield:$$p \rightarrow p+\phi(p)+1=p+p-1+1=2p$$and so any prime is initially doubled by this process. Remember the totient \( \phi(n) \) of \(n\) is the number of coprime integers less than \(n\), including 1.

Using SageMathCell, I was able to quickly determine the trajectories for all numbers up to 6000  and the distribution is shown in Figure 1. The vertical axis shows the trajectory length while the horizontal axis shows the number. Some of the record trajectories are shown in Figure 1 as well e.g. (97, 152) indicates that the number 97 sets a new trajectory record length of 152.


Figure 1: permalink

Below are shown the numbers that produce trajectories of record length, together with those lengths:
  •       1  has a trajectory of record length      1
  •       2  has a trajectory of record length      2
  •       3  has a trajectory of record length      8
  •     31  has a trajectory of record length     10
  •     42  has a trajectory of record length     31
  •     97  has a trajectory of record length   152
  •  1907  has a trajectory of record length   166
  •  2130  has a trajectory of record length   217
  •  3067  has a trajectory of record length   224
  •  5243  has a trajectory of record length   232
  •  7355  has a trajectory of record length   302
  •  7604  has a trajectory of record length   307
  • 10956 has a trajectory of record length >344
SageMathCell timed out for 10956 because the composite numbers were becoming unwieldingly large. See Figure 2.


Figure 2

The final number is the list shown in Figure 2 is:

128273423043384555138014803867139463949464184741011497767099217473602278 

It was at this point that SageMathCell gave up. Presumably the trajectory of 10956 does terminate but so far I've not been able to determine its exact length, although we know it's larger than 344. The average number of iterations is slightly over 14 in the range up to 6000.

I may have more to add on this recursive process at a later date.

Monday, 9 August 2021

Compositions of 365 and 366

Once the number of days that have elapsed during a calendar year and the number of days that remain are compared, we can look at this as a composition or ordered partition of either 365 during a non-leap year or 366 during a leap year. This composition or ordered partition contains only two elements. Let's consider the compositions of 365 and 366 separately.

Compositions of 365

Because the two elements must add to an odd number, one must be odd and the other even. So there can be no two elements that are both prime. The same applies to lucky numbers that are all odd. Having established that, let's look at some other possibilities.

  • Both elements are semiprimes: there are 32 such compositions e.g. (355, 10) or (10, 355) where 10 = 2 x 5 and 355 = 5 x 73. The full list is:

    [(355, 10), (339, 26), (327, 38), (326, 39), (319, 46), (314, 51), (303, 62), (291, 74), (278, 87), (274, 91), (259, 106), (254, 111), (247, 118), (219, 146), (206, 159), (187, 178), (178, 187), (159, 206), (146, 219), (118, 247), (111, 254), (106, 259), (91, 274), (87, 278), (74, 291), (62, 303), (51, 314), (46, 319), (39, 326), (38, 327), (26, 339), (10, 355)]

    • Both elements are semiprimes with no factors in common: there are 28 such compositions e.g. (339, 26) or (26, 339) where 26 = 2 x 13 and 339 = 3 x 113. The full list is:

    [(339, 26), (327, 38), (326, 39), (319, 46), (314, 51), (303, 62), (291, 74), (278, 87), (274, 91), (259, 106), (254, 111), (247, 118), (206, 159), (187, 178), (178, 187), (159, 206), (118, 247), (111, 254), (106, 259), (91, 274), (87, 278), (74, 291), (62, 303), (51, 314), (46, 319), (39, 326), (38, 327), (26, 339)] 

    • Both elements are semiprimes with one factor in common: there are 4 such compositions e.g. (219, 146) or (146, 219) where 146 = 2 x 73 and 219 = 3 x 73. The full list is:

    [(355, 10), (219, 146), (146, 219), (10, 355)]

    • Both elements are sphenic numbers, meaning that they have three distinct prime factors: there are 4 such compositions e.g. (255, 110) or (110, 255) where 110 = 2 x 5 x 11 and 255 = 3 x 5 x 17. There are none in the gcd or greatest common divisor is 1. The full list is:

    [(255, 110), (195, 170), (170, 195), (110, 255)] 

    • Both elements are NOT square free: there are 44 such compositions e.g. (361, 4) or (4, 361) where 4 = 2 x 2 and 361 = 19 x 19. The full list is:

    [(361, 4), (356, 9), (340, 25), (338, 27), (333, 32), (325, 40), (320, 45), (316, 49), (315, 50), (297, 68), (289, 76), (284, 81), (275, 90), (261, 104), (248, 117), (245, 120), (244, 121), (240, 125), (225, 140), (212, 153), (196, 169), (189, 176), (176, 189), (169, 196), (153, 212), (140, 225), (125, 240), (121, 244), (120, 245), (117, 248), (104, 261), (90, 275), (81, 284), (76, 289), (68, 297), (50, 315), (49, 316), (45, 320), (40, 325), (32, 333), (27, 338), (25, 340), (9, 356), (4, 361)]

    Compositions of 366

    • Both elements are prime: there are 36 such compositions e.g. (359, 7) and (7, 359). The full list is:

    [(359, 7), (353, 13), (349, 17), (347, 19), (337, 29), (313, 53), (307, 59), (293, 73), (283, 83), (277, 89), (269, 97), (263, 103), (257, 109), (239, 127), (229, 137), (227, 139), (199, 167), (193, 173), (173, 193), (167, 199), (139, 227), (137, 229), (127, 239), (109, 257), (103, 263), (97, 269), (89, 277), (83, 283), (73, 293), (59, 307), (53, 313), (29, 337), (19, 347), (17, 349), (13, 353), (7, 359)]

    • Both elements are lucky numbers: the lucky numbers in the range between 1 and 366 are:

    [1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, 43, 49, 51, 63, 67, 69, 73, 75, 79, 87, 93, 99, 105, 111, 115, 127, 129, 133, 135, 141, 151, 159, 163, 169, 171, 189, 193, 195, 201, 205, 211, 219, 223, 231, 235, 237, 241, 259, 261, 267, 273, 283, 285, 289, 297, 303, 307, 319, 321, 327, 331, 339, 349, 357, 361, 363] 

    There are 20 compositions in which both elements are lucky numbers. These are:

    [(363, 3), (357, 9), (303, 63), (297, 69), (273, 93), (267, 99), (261, 105), (237, 129), (231, 135), (195, 171), (171, 195), (135, 231), (129, 237), (105, 261), (99, 267), (93, 273), (69, 297), (63, 303), (9, 357), (3, 363)] 

    A More General Strategy

    Possibly the most useful strategy in this sort of analysis is to list all the numbers between 1 and 366 that have a certain property, such as being lucky (like I just did). A completely general algorithm can then be applied that relies only on the list. Let's consider some happy numbers as an example:

    Happy numbers: there are 57 such numbers in the range between 1 and 366. These are:

    [1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103, 109, 129, 130, 133, 139, 167, 176, 188, 190, 192, 193, 203, 208, 219, 226, 230, 236, 239, 262, 263, 280, 291, 293, 301, 302, 310, 313, 319, 320, 326, 329, 331, 338, 356, 362, 365]

    Here is the general algorithm in SageMath:


    Figure 1: permalink

    Thus we see that there are 6 such pairs in a non-leap year:

    [(262, 103), (236, 129), (226, 139), (139, 226), (129, 236), (103, 262)]

    The algorithm is easily modified to accommodate leap years and in this case we find that there are 14 such pairs:

    [(365, 1), (356, 10), (338, 28), (280, 86), (263, 103), (236, 130), (190, 176), (176, 190), (130, 236), (103, 263), (86, 280), (28, 338), (10, 356), (1, 365)] 

    The list in the algorithm above could be replaced with the list of lucky numbers or any other list and the appropriate pairings could be found. I'll collect these lists together in my online Sage documentation accessible via this link and listed under 365 and 366.

    Thursday, 27 May 2021

    The p-adics

    In a post on January 17th 2019 title The Golden Key, I wrote:

    I came across the Golden Key when perusing Kumar Asok Mallik's book The Story of Numbers during his introduction to prime numbers on page 23. This is quite an interesting book that I've added to my Calibre library ... If I can read an entry a day from this book, I'll soon be a wiser man mathematically.

    Well it's no surprise that I didn't read an entry a day and in fact I only stumbled upon the post and its reference to Mallik's book when searching for posts related to \(p\)-adic numbers (which he discusses in his book). There is a good article on the \(p\)-adics in Quanta Magazine titled An Infinite Universe of Number Systems. Figure 1 shows a visualisation of 3-adic numbers:


    Figure 1

    The diagram makes sense when the following diagrams are considered in Figures 2, 3 and 4. The tube-like structures arise when\(\mod{3^n}\) with \(n=1, 2, 3, ... \) is applied progressively to the natural numbers. The natural numbers become grouped in an entirely new way.

    Figure 2

    Figure 3



    Figure 4

    Looking at Figure 4, it's clear in this system that 37 is closer to 10 than it is to 36. As the quanta article explains it:
    The size of a \(p\)-adic number is determined by the prevalence of \(p\) in its prime factorisation. Numbers with more \(p\)s are smaller. For example, in the 3-adics, \(486_{10}=200000_3\) is “small” because it has many 3s in its prime factorisation (486 = 2 x 3 x 3 x 3 x 3 x 3). Another way to think about size is to think about which numbers are close to 0. In the \(p\)-adics, integers are closer together when they share a room at higher levels of the tower. The numbers 0 and 486 share a room up to the fifth level, whereas 0 and 6 share a room on only the first level — indicating that 0 is closer to 486 than to 6 and thus 486 is smaller than 6.
    Mallik uses the 7-adic number system for illustration purposes. Here he talks about negative numbers in such a system:
    A surprising fact is that for \(p\)-adic integers we do not need any negative sign to indicate negative integers. We determine the negative of a positive integer by determining what needs to be added to this positive integer to yield zero, i.e., by subtracting this number from 0. For example 7-adic expansion of −1 can be written as an integer . . . 6 6 6 6 with infinitely many 6’s on the left. We can verify this result by adding 1 to this 7-adic integer: 
    · · · 6 6 6 6 + · · · 0 0 0 1 = · · · 0 0 0 0
    Thus we can write that \(-1 = 6  +6 \times 7 + 6 \times 7^2 + 6 \times 7^3 + ... \) which seems odd but if 1 is added to both sides we see that it is in fact true. He goes on to say that:
    Now we show that some \(p\)-adic integers also represent rational fractions like, say, 1/2. The 7-adic integer · · · 3 3 3 4 with infinitely many 3’s represents 1/2, as can easily verified by multiplying this number by 2 or by adding this number to itself:

     · · · 3 3 3 4  x  2 = · · · 0 0 0 1  

    Mallik goes on to mention that \( \sqrt{2} = · · · \text{ 6 2 1 3 } \) because:

    · · · 6 2 1 3  x  · · · 6 2 1 3 = · · · 0 0 0 2

    Figure 5 shows how 5-adic numbers can be equal to \( \sqrt{-1} \):


    Figure 5: source

    It's easy to get confused by the above and perhaps this paper is a better introduction to the mechanics of the topic as it details how to add, subtract, multiply and divide p-adic numbers. Furthermore, it points out the difference between the p-adic representation of a number and the p-ary. See Figure 6.


    Figure 6: source

    The p-adic numbers pop up everywhere in higher Mathematics. For example, consider this article is Quanta Magazine titled Mathematicians Find Long-Sought Building Blocks for Special Polynomials. Figure 7 features a photo of "Benedict Gross (who) was the first to use p-adic numbers to look for the numerical building blocks that Hilbert’s 12th problem asks for. The approach proved successful, decades later."


    Figure 7

    SageMath can be adapted to help us in changing decimal integers and fractions into p-adic form. Figure 9 shows the conversion of 26353 into its 7-adic form:


    Figure 9: permalink

    To change a decimal fraction into a so-called "basimal" is not difficult. Using 1/2 and base 7 as an example, here is the SageMath code in blue with output in red:

    ring=RealField(30)
    ring(1/2).str(base=7)

    '0.333333333333'

    The 30 just indicates the degree of precision. We see that the 7-ary form of 1/2 is \(0.\overline{3} \). However, this now needs to changed in 7-adic form and to this we need to reverse the order of the digits and place everything to the left of the decimal point. Additionally, 1 must be added to the right-most digit when in the p-adic form:$$0.333333 \dots \rightarrow \dots 333333.0 \rightarrow \dots 333334.0 \rightarrow \overline{3}4.0$$If we multiply this number by 2, the result is 1 and so the representation is correct.

    If there is a decimal part in addition to the integer then both parts can be processed together:

    n=12.5
    n.str(base=7)

    '15.333333333333333333'

    Changing from 7-ary form to 7-adic form we get: \( \overline{3}4.51 \).

    Wednesday, 16 December 2020

    Friendly versus Solitary Numbers

    Today I turned 26190 days old and discovered that this number forms one half of a friendly pair of numbers. The other half is 8148. What do these two numbers have in common? Well, we find that:$$ \frac{\sigma_1(26190)}{26190}=\frac{70560}{26190}=\frac{784}{291} \text{ and } \frac{\sigma_1(8148)}{8148}=\frac{21952}{8148}=\frac{784}{291}$$So if the sum of the divisors of one number divided by that number is the same as the sum of the divisors of another divided by that other number, then the numbers are said to be friendly. Friendly numbers are not to be confused with amicable numbers where the numbers are related in such a way that the sum of the proper divisors of one is equal to the sum of the proper divisors of the other. The smallest pair of amicable numbers is 220 and 284. 

    Getting back to friendly numbers, we find that friendly triples and higher-order tuples are also possible. Friendly triples include: 

    • (2160, 5400, 13104)
    • (9360, 21600, 23400)
    • (4320, 4680, 26208)
    Friendly quadruples include: 

    • (6, 28, 496, 8128)
    • (3612, 11610, 63984, 70434)
    • (3948, 12690, 69936, 76986)
    Friendly quintuples include:

    • (84, 270, 1488, 1638, 24384)
    • (30, 140, 2480, 6200, 40640)
    • (420, 7440, 8190, 18600, 121920)
    Numbers that have friends are called friendly numbers, and numbers that do not have friends are called solitary numbers.

    This ratio of the sum-of-divisors of an integer \(n\) to the integer itself is termed its abundancy and is defined as: \( \displaystyle \frac{\sigma_1(n)}{n}\).

    By this definition, two numbers are friendly is they have the same abundancy.  Two numbers with the same abundancy form a friendly pair; \(n\) numbers with the same abundancy form a friendly \(n\)-tuple. 

    Abundancy may also be expressed as \( \sigma _{-1}(n)\) where \( \sigma _{k} \) denotes the sum of the \(k\)-th powers of the divisors of \(n\). When \(k\)=-1, we have the sum of the reciprocals of the divisors. The abundancy of a number \(n\) should not be confused with its abundance \( A(n) \equiv  \sigma_1(n)-2n \). Refer to WolframMathWorld.

    From Wikipedia we learn that:

    if the numbers \(n\) and \( \sigma(n) \) are coprime – meaning that the greatest common divisor of these numbers is 1, so that \( \sigma(n)/n \) is an irreducible fraction – then the number \(n\) is solitary. For a prime number \(p\), we have \( \sigma_1(p) = p + 1\), which is co-prime with \(p\).

    Thus all primes and multiples of primes are solitary. Wikipedia continues:

    No general method is known for determining whether a number is "friendly" or solitary. The smallest number whose classification is unknown is 10; it is conjectured to be solitary. If it is not, its smallest friend is at least \(10^{30}\). Small numbers with a relatively large smallest friend do exist: for instance, 24 is "friendly", with its smallest friend 91,963,648.

    Mutually friendly numbers as we said earlier can form friendly \(n\)-tuples that might be considered families or clubs. It's an open question whether these families have an infinite number of members. For example, it is conjectured that there are infinitely many perfect numbers but only 51 are currently known. Each perfect number has an abundancy of 2 and thus currently the perfect numbers form a 51-tuple or a family with 51 members. 

    Similarly multiply perfect numbers form friendly families but firstly let's define what is meant by a multiply perfect numbers:
    For a given natural number \(k\), a number \(n\) is called \(k\)-perfect (or \(k\)-fold perfect) if and only if the sum of all positive divisors of \(n\) (the divisor function, \( \sigma(n) \), is equal to \(k \times n\); a number is thus perfect if and only if it is 2-perfect. A number that is \(k\)-perfect for a certain \(k\) is called a multiply perfect number. As of 2014, \(k\)-perfect numbers are known for each value of \(k\) up to 11. Source. Also see my blog post Multiperfect, Hyperfect and Superperfect Numbers from July 24th 2019.

    The club of friendly numbers with abundancy equal to 9 has 2094 known members but these multiply perfect clubs or families are thought to be finite (unlike the perfect family that is conjectured to be infinite).

    There are a number of OEIS sequences associated with friendly and solitary numbers. It was stated earlier that numbers that are coprime with their sum of divisors are solitary but this is sufficient and not necessary condition for solitariness. OEIS A095739 lists those numbers that are solitary and yet not coprime with their sum of divisors:


     A095739





    Numbers
     known to be solitary but not coprime to sigma.         

    The first of these numbers are 18, 45, 48, 52, 136, 148, 160, 162, 176, 192, 196, 208, 232, 244, 261, 272, 292, 296, 297, 304, 320, 352, 369, ...

    26190, the number that began this post, is a member of OEIS A050973:


    A050973

    Larger member of friendly pairs ordered by smallest maximal element.   


    The initial member of this sequence are:
    28, 140, 200, 224, 234, 270, 308, 364, 476, 496, 496, 532, 600, 644, 672, 700, 812, 819, 868, 936, 1036, 1148, 1170, 1204, 1316, 1400, 1484, 1488, 1488, 1540, 1638, 1638, 1638, 1652, 1708, 1800, 1820, 1876, 1988, 2016, 2044, 2200, 2212, 2324, ...

    The smaller members of these pairs are given by OEIS A050972:


    A050972

    Smaller member of friendly pairs ordered by smallest maximal element.    


    The initial members of this sequence are:
    6, 30, 80, 40, 12, 84, 66, 78, 102, 6, 28, 114, 240, 138, 120, 150, 174, 135, 186, 864, 222, 246, 60, 258, 282, 560, 318, 84, 270, 330, 84, 270, 1488, 354, 366, 720, 390, 402, 426, 360, 438, 880, 474, 498, 510, 440, 30, 140, 534, 132, 1040, 570, 582, 606, ...

    From these sequences, we can form the various pairs e.g. 28 and 6, 140 and 30 etc. Notice the two numbers (819 and 135) marked in bold in the above sequences. This pair are an example of two odd numbers being friendly. There are also cases of even being friendly to odd, such as 42 and 544635 with abundancy 16/7.