Showing posts with label squarefree. Show all posts
Showing posts with label squarefree. Show all posts

Sunday, 6 October 2024

Getting SageMath Help From Gemini

The number associated with my diurnal age yesterday, 27579, has the property that it represents the number of squarefree, Carlitz compositions of 22. An example of such a composition would be [ 2, 3, 1, 5, 7, 3, 1 ] where no adjacent elements are equal and all elements are squarefree. The number 27579 is a member of OEIS A301500:


A301500: number of compositions (ordered partitions) of \(n\) into squarefree parts (A005117) such that no two adjacent parts are equal (Carlitz compositions).


The initial members of this sequence are:

1, 1, 1, 3, 3, 5, 11, 15, 25, 45, 69, 115, 193, 309, 513, 849, 1387, 2291, 3771, 6189, 10195, 16773, 27579, 45391, 74675, 122837, 202111, 332507, 547011, 899949, 1480583, 2435803, 4007361, 6592863, 10846405, 17844319, 29357197, 48297813, 79458705, 130724101, 215064673

I tried to develop some working SageMath code to generate the number of suitable compositions for a particular value of \(n\) but was constantly thwarted for reasons unknown. I thought I'd try to get some help from Google's Gemini and initially asked for some Python code. This didn't work and the second request also failed, so I asked for SageMath code and though the first code provided failed, the second worked. See Figure 1.


Figure 1: permalink

The code executes swiftly on SageMathCell but as usual I don't really understand the details of how it works. However, Gemini can be called upon to explain its own code and it does quite a good job. After reading the explanation, I have a much clearer idea of what's going on. Here is a public link to my question and Gemini's response.

What I notice is that the "professional code" is so much more efficient from my own. I generally get my SageMath code to work but I realise that my code is rarely very efficient. Anyway, the point of this post is a reminder to myself, and perhaps others, that Gemini can generate quite efficient SageMath code and does a good job of explaining how that code works.

Friday, 4 October 2024

Semiprime Chains

The number associated with my diurnal age today is 27578 and it is a squarefree semiprime with an interesting property. Let's consider its two factors and subtract the smaller from the larger factor and apply the same rule to the difference. Keep repeating this process until the difference is not a squarefree semiprime. The result is as follows:$$ \begin{align} 27578 &= 2 \times 13789\\ 13789-2 &= 13787 \\13787 &= 17 \times 811\\811-17 &=794 \\794 &= 2 \times 397\\397-2 &= 395 \\ 395 &= 5 \times 79 \\79 -5 &= 74 \\ 74 &= 2 \times 37\\37-2 &= 35\\35 &= 5 \times 7 \end{align}$$Once we reach 35, the chain of semiprimes terminates because the difference between 7 and 5 is 2 and 2 is not a squarefree semiprime. However, the process does generate a chain of semiprimes:$$27578 \rightarrow 13787 \rightarrow 794 \rightarrow 395 \rightarrow 74 \rightarrow 35$$Squarefree semiprimes like 27578 that produce another five squarefree semiprimes by subtraction of their prime factors belong to OEIS A296812:


A296812
    Take a squarefree semiprime and take the difference of its prime factors. If it is a squarefree semiprime repeat the process. Sequence lists the squarefree semiprimes that generate other squarefree semiprimes only in the first \(k\) steps of this process. Case \(k \geq 5\).

The initial members of this sequence, up to 40000, are (permalink):

4786, 5991, 6218, 8351, 9995, 13391, 14367, 15434, 16658, 16706, 18663, 19466, 27578, 28738, 33551, 34082, 34187, 37727, 38823

The numbers marked in red correspond to the case where \(k \geq 6\), although these numbers are not listed in the OEIS. Take 33551 as an example:$$ \begin{align} 33551 &= 7 \times 4793\\4793 - 7 &= 4786\\4786 &= 2 \times 2393\\2393-2 &= 2391\\2391 &= 3 \times 797\\797-3 &= 794\\794 &= 2 \times 397\\397-2 &= 395\\ 395 &= 5 \times 79\\ 79 - 5 &=74\\74 &= 2 \times 37\\37-2 &=35\\35 &= 5 \times 7 \end{align}$$The number in blue in the list above (28738) corresponds to the case where \(k\)=7 and the prime factors of this number are 2 x 14369 which leads us to 14367 (one of the red numbers).

A similar process involving addition of the prime factors could be applied this would lead, in the case of \(k \geq 5\), to this sequence of numbers:

1774, 2566, 2913, 4497, 6382, 6769, 8902, 9286, 10334, 15177, 19357, 28177, 34669, 35913, 37857

Take 1774 as an example where we have:$$ \begin{align} 1774 &= 2 \times 887\\ 887+2 &= 889\\889 &= 7 \times 127\\127+7 &=134\\134 &= 2 \times 67\\67+2 &= 69\\ 69 &= 3 \times 23\\23+3 &= 26\\26 &= 2 \times 13\\13+2 &=15\\15 &= 3 \times 5 \end{align} $$These numbers are NOT listed in the OEIS. I'm sure some of these numbers could be taken further as with the differences but I'll leave it there for now.

Saturday, 28 January 2023

What's Special About 26962?

I'm following my tradition of making a special post for my palindromic days. The last one was 26862 and titled What's Special About 26862? Now I've reached 26962 and this palindrome has some interesting properties. The first is that it can be split up into two factors, each of which is the reverse of the other (with square numbers such as 121 excluded).

26962 = 122 x 221 = 221 x 122

There are not many palindromes with this property in the range up to one million. Here is the list:

  • 252 =12 x 21 = 21 x 12
  • 20502 = 102 x 201 = 201 x 102
  • 23632 = 112 x 211 = 211 x 112
  • 26962 = 122 x 221 = 221 x 122
As can be seen, 26962 is last palindrome with this property in the range up to one million. We have to extend the range in order to find more. In the range between one and two million, the following palindromes are found (permalink):
  • 1113111 = 1011 x 1101 = 1101 x 1011
  • 1226221 = 1021 x 1201 = 1201 x 1021
  • 1357531 = 1121 x 1211 = 1211 x 1121
Notice how all the factors are comprised of the digits 0, 1 and 2 only. If we relax the rule that square numbers are excluded then, with their inclusion, 26962 is a member of OEIS A158642:


 A158642

Palindromic numbers which are the product of a number n and its reversal (n written backwards)



The members of this sequence, up to two million, are:

0, 1, 4, 9, 121, 252, 484, 10201, 12321, 14641, 20502, 23632, 26962, 40804, 44944, 1002001, 1113111, 1226221, 1234321, 1357531

The previously mentioned non-square numbers are marked in blue.

********************************************

26962 is a palindrome which is 
a product of a pair of emirpimes

In the case of 26962, it can be noted that the factors 122 and 221 are products of emirpimes:
  • 122 = 2 x 61
  • 221 = 13 x 17
This property of being a product of emirpimes qualifies 26962 for membership in OEIS A158126:


 A158126

Products of emirpimes pairs, sorted.                                    


The initial members of the sequence are:

765, 1612, 3627, 4606, 4930, 26962, 39483, 48763, 58765, 61306, 69723, 85405, 102910, 107485, 118809, 129682, 134458, 136467, 140572, 146047, 148930, 151209, 155038, 162409, 178555, 194242, 196315, 203098, 213310, 236421, 283798, 291247

********************************************

26962 is a palindrome 
with four distinct prime factors

26962 has four distinct prime factors: 2, 13, 17 and 61. Palindromes with this property are fairly rare and constitute OEIS A046394

 
 A046394

Palindromes with exactly four distinct prime factors.                              



The initial members of this sequence, up to 100,000, are (permalink):

858, 2002, 2442, 3003, 4774, 5005, 5115, 6666, 10101, 15351, 17871, 22422, 22722, 24242, 26562, 26962, 28482, 35853, 36363, 41314, 43734, 43834, 45654, 47874, 49494, 49794, 49894, 51015, 51315, 51415, 53535, 53835, 53935, 56865, 58485, 59295, 59595, 60006, 62526, 62826, 64246, 64446, 66666, 66766, 68286, 73437, 74347, 78387, 81618, 81718, 83638, 83838, 87078, 87178, 89598, 89698, 92829, 96369, 98889

26962 is also a palindrome in base 11, being represented as 19291. This property qualifies it for membership in OEIS A180454.

********************************************

26962 can be written as a sum of two distinct palindromic primes in three different ways

Still on the topic of palindromes, 26962 is a member of OEIS A356854:


 A356854

Palindromes that can be written in more than one way as the sum of two distinct palindromic primes.



The primes are 10301 + 16661 = 10601 + 16361 = 11411 + 15551 = 26962.

The initial members of the sequence are (permalink):

282, 484, 858, 888, 21912, 22722, 23832, 24642, 25752, 26662, 26762, 26862, 26962, 27672, 27772, 27872, 27972, 28482, 28782, 28882, 28982, 29692, 29792, 29892, 29992, 40704, 41514, 41614, 41814, 42624, 42824, 42924, 43434, 43734, 43834, 43934, 44744, 44844, 44944, 45354

********************************************

26962 is a palindromic Ulam number

26962 is also an Ulam number and so, being a palindromic Ulam number, it qualifies for membership in OEIS A173542:


 A173542

Palindromic Ulam numbers.   
                                       


The initial members of the sequence are:

1, 2, 3, 4, 6, 8, 11, 77, 99, 131, 282, 363, 414, 434, 585, 646, 949, 2112, 2332, 2552, 2662, 5335, 5665, 8008, 8338, 8668, 10501, 13531, 13931, 15251, 16961, 17071, 18381, 18581, 18681, 22122, 22322, 23632, 23932, 25452, 26962, 28582, 28682, 30703, 30803, 32123

Saturday, 7 January 2023

A Prime and Semiprime Generating Quadratic Polynomial

The quadratic \(2n^2+29\) is especially adept at generating primes and semiprimes. Initially it generates 29 distinct primes for \(n = 0, 1, \dots, 28\). The primes are:

29, 31, 37, 47, 61, 79, 101, 127, 157, 191, 229, 271, 317, 367, 421, 479, 541, 607, 677, 751, 829, 911, 997, 1087, 1181, 1279, 1381, 1487, 1597

When \(n=29\), the first semiprime, 1711 = 29 x 59 is generated. This is in fact how I first encountered this quadratic. My diurnal age today is 26941 and this number is a member of OEIS A241554:


 A241554

Semiprimes generated by the polynomial 2 * n^2 + 29                                     

 The initial members of the sequence are:

1711, 1829, 2077, 2479, 3071, 3901, 5029, 6527, 6757, 7471, 7967, 8479, 10397, 10981, 11581, 14141, 15167, 15517, 15871, 16591, 16957, 17701, 18079, 18847, 19631, 20837, 22927, 23791, 25567, 26941, 27877, 28829, 29797, 30287, 31279, 31781, 32287, 35941, 38117

In the range from 0 to 1000 (1001 numbers overall),  there are:

  • 497 primes or about 49.7%
  • 446 semiprimes or about 44.6%
  • 58 triprimes or about 0.58%

There are no numbers with more than three factors. The first triprime is reached when \(n=185\) and this is \(68479 = 31 \times 47^2\) and this is also the first square-free number as well. This means that none of the previous semiprimes are square numbers.

The first composite numbers with four prime factors is reached when \(n=1334\) and this is 3559141 = 29 x 31 x 37 x 107. In the range up to 5000, there are only twenty such numbers. These are:

  • 1334 --> 3559141 = 29 * 31 * 37 * 107
  • 1704 --> 5807261 = 31 * 37 * 61 * 83
  • 2444 --> 11946301 = 37 * 61 * 67 * 79
  • 2958 --> 17499557 = 29 * 37 * 47 * 347
  • 3132 --> 19618877 = 29 * 31 * 139 * 157
  • 3481 --> 24234751 = 47 * 61 * 79 * 107
  • 3628 --> 26324797 = 31 * 37 * 59 * 389
  • 3688 --> 27202717 = 31 * 59 * 107 * 139
  • 3857 --> 29752927 = 29 * 47 * 83 * 263
  • 3945 --> 31126079 = 47 * 79 * 83 * 101
  • 3998 --> 31968037 = 31 * 37 * 47 * 593
  • 4031 --> 32497951 = 29 * 31 * 37 * 977
  • 4186 --> 35045221 = 31 * 47 * 67 * 359
  • 4277 --> 36585487 = 31 * 59 * 83 * 241
  • 4327 --> 37445887 = 37 * 47 * 61 * 353
  • 4438 --> 39391717 = 37 * 83 * 101 * 127
  • 4640 --> 43059229 = 29 * 61 * 101 * 241
  • 4775 --> 45601279 = 31 * 37 * 83 * 479
  • 4859 --> 47219791 = 67^3 * 157
  • 4930 --> 48609829 = 29 * 31 * 139 * 389
Overall, in the range up to 5000, there are:

  • 1920 primes or about 38%
  • 2436 semiprimes or about 49%
  • 625 triprimes or about 12.5%
  • 20 other composite numbers (listed above) or less than 0.5%
If we extend the range to 10000, there are (permalink):
  • 3484 primes or about 35%
  • 4904 semiprimes or about 49%
  • 1540 triprimes or about 15.5%
  • 73 other composite numbers or about 0.5%
In the range up to 100000 there are:
  • 27545 primes or about 27%
  • 46605 semiprimes or about 47%
  • 22575 triprimes or about 23%
  • 3276 other composite numbers or about 3%
Thus as the range increases, the percentage of primes steadily decreases (49.7% --> 38% --> 35% --> 27%) while the percentage of semiprimes remains fairly steady (44.6% --> 49% --> 49% --> 47%). Overall, this quadratic would seem to be best at producing semiprimes and at a steady rate of almost 50%.

I do make passing reference to this quadratic polynomial in a post from February 26th 2022 titled Another Prime Generating Polynomial. It appears in the following table:


As can be seen, \(2n^2+29\) makes an appearance together with \(2n^2+11\), these being the only quadratic polynomials without a linear term. I also have an earlier post from March 18th 2020 titled Prime Generating Quadratic Polynomials.

Monday, 13 June 2022

Squarefree Semiprime Chains

The number associated with my diurnal age today, 26734, has an interesting property that qualifies it for membership in OEIS A177215:

A177215 Numbers \(k\) that are the products of two distinct primes such that \(2k-1, 4k-3, 8k-7, 16k-15, 32k-31 \text{ and } 64k-63\) are also products of two distinct primes.

Let's confirm that:

There are 281 members of OEIS  A177215 up to one million. I'll use the highest of them, 998185, as an example. It has the properties shown below:


What if we raise the stakes so to speak and apply the additional criterion that \(128k-123\) is also a semiprime with two distinct prime factors (in other words it's squarefree)? Well, the number shrinks to 81 in the range up to one million. The highest number that qualifies in that range is 991237 with the following properties:


Let's push thing further. How many numbers qualify once we add the additional criterion of \(256k-255\) being a squarefree semiprime? The number now reduces to 29, the highest of which remains our 991237. The revised table is shown below:


Let's keep pushing. How many numbers quality if we add the additional criteria that \(512k-511\) must be a squarefree semiprime? The number is now down to 14 and 991237 is still at the top. Here's the revised table.


Pushing further to include \(1024k-1023\), we find that only four numbers qualify in the range up to one million. These are 173311, 346621, 464245 and 563326. The table below shows the properties for 563326:


Proceeding logically, we now look at the criterion \(2056k-2055\) and we find that there is only one man left standing and that is 173311. Its table properties is shown below:


So overall, an interesting journey that ends with 173311 because this number doesn't pass the \(4096k-4095\) test. Of course, the journey never ends. We must ask what is the smallest number greater than one million that satisfies the criterion that \(4096k-4095\) is a squarefree semiprime? Well that number is 2212801. It's properties are shown below:


I'll stop there but here is a SageMathCell permalink to the program that I was using to discover these numbers. Feel free to experiment further.

ADDENDUM:

After making this post, I discovered that I'd covered much of the same territory in a post from October 17th 2018 titled Semiprime Chains. It will teach me to look back over my previous posts before posting. I've made so many posts of the years that it's easy to forget my earlier posts. One thing that is different between the two posts is the code that I used. The latter code is far more succinct. It's just as well that I looked back because the embedded code that I'd used was outdated. It contained the superseded print \(n\) command instead of the Python 3 print(\(n\)) command. I've corrected that now.

Here are the links to my previous posts on semiprimes:

Sunday, 1 August 2021

Primitive Practical Numbers

On July 31st 2018, three years and one day ago, I created a post titled Practical Numbers. To quote from that post:

In number theory, a practical number or panarithmic number is a positive integer \(n\) such that all smaller positive integers can be represented as sums of distinct divisors of \(n\). For example, 12 is a practical number because all the numbers from 1 to 11 can be expressed as sums of its divisors 1, 2, 3, 4, and 6: as well as these divisors themselves, we have 5 = 3 + 2, 7 = 6 + 1, 8 = 6 + 2, 9 = 6 + 3, 10 = 6 + 3 + 1, and 11 = 6 + 3 + 2. Wikipedia.

That is straightforward enough and, before we progress to the concept of primitive practical numbers, let's familiarise ourselves with the concept of a complete sequence. Here is a definition:

In mathematics, a sequence of natural numbers is called a complete sequence if every positive integer can be expressed as a sum of values in the sequence, using each value at most once.

For example, the sequence of powers of two (1, 2, 4, 8, ...), the basis of the binary numeral system, is a complete sequence; given any natural number, we can choose the values corresponding to the 1 bits in its binary representation and sum them to obtain that number (e.g. \(37 = 100101_2 = 1 + 4 + 32\)). This sequence is minimal, since no value can be removed from it without making some natural numbers impossible to represent. Simple examples of sequences that are not complete include the even numbers, since adding even numbers produces only even numbers—no odd number can be formed. Wikipedia.

Primitive practical numbers are defined in OEIS A267124:


 A267124

Primitive practical numbers: practical numbers that are square-free or practical numbers that when divided by any of its prime factors whose factorisation exponent is greater than 1 is no longer practical.

 The accompanying comments in the OEIS entry are informative:

If \(n\) is a practical number and \(d\) is any of its divisors then \(n \times d\) must be practical. Consequently, the sequence of all practical numbers must contain members that are either square-free (A265501) or when divided by any of its prime factors whose factorisation exponent is greater than 1 is no longer practical. Such practical numbers are said to be primitive. The set of all practical numbers can be generated from the set of primitive practical numbers by multiplying these primitives by any of their divisors.

The examples are given of:

  • \(a(4)=20=2^2 \times 5\). It is a practical number because it has 6 divisors 1, 2, 4, 5, 10, 20 that form a complete sequence. If it is divided by 2 the resultant has 4 divisors 1, 2, 5, 10 that is not a complete sequence. Thus it is a primitive practical number.

  • \(a(7)=42=2 \times 3 \times 7\). It is square-free and is practical because it has 8 divisors 1, 2, 3, 6, 7, 14, 21, 42 that form a complete sequence. Thus it is a primitive practical number.
12 as an example of a practical number that is not primitive. It has divisors 1, 2, 3, 4, 6, 12 that form a complete sequence. It is not square-free and, when divided by 2 (a prime factor whose factorisation exponent is greater than 1), the result is 6 which is still a practical number. 6 in fact is a primitive practical number because it is a practical number that is square-free.

The initial primitive practical numbers are:
1, 2, 6, 20, 28, 30, 42, 66, 78, 88, 104, 140, 204, 210, 220, 228, 260, 272, 276, 304, 306, 308, 330, 340, 342, 348, 364, 368, 380, 390, 414, 460, 462, 464, 476, 496, 510, 522, 532, 546, 558, 570, 580, 620, 644, 666, 690, 714, 740, 744, 798, 812, 820, 858, 860, 868, 870, 888, 930, 966, 984 

Let's examine the first 8 primitive practical numbers: 1, 2, 6, 20, 28, 30, 42 and 66. The differences between these terms are 1, 4, 14, 8, 2, 12 and 24. The record gaps are 1, 4, 14 and 24, which occur after the terms 1, 2, 6 and 42. If we extend our examination of these record gaps and note the terms before which they occur, we end up with OEIS A334883:


 A334883

Primitive practical numbers (A267124) with a record gap to the next primitive practical number.


The initial terms making up this sequence are:
1, 2, 6, 42, 104, 140, 1036, 1590, 2730, 7900, 10374, 19180, 22660, 23180, 26418, 105868, 114960, 139060, 295780, 403524, 482250, 1294144, 2468944, 4799058, 5379282, 19035500, 20233936, 21803860, 112406992, 789190976, 3520928922

What drew my attention to this sequence and to primitive practical numbers in general was the fact that my diurnal age today is 26418. The gap to the next primitive practical number 26572 is 154 but that record is not broken until 105868, after which there is a gap of 188 to 106056.

Monday, 11 November 2019

Bell Numbers

Figure 1: book cover
I came across an interesting book titled Combinatorics and Number Theory of Counting Sequences by István Mezö and, while most of the content looks intimidating, the author starts off very simply. He certainly gets around as the brief biographical details in Figure 2 reveal. He has a website on Google Sites and interestingly he also has something to say about surreal numbers which I haven't heard anything of since reading Donald Knuth's eponymous book. Well, I started reading it but didn't finish. Maybe this guy can rekindle my interest.
Figure 2: brief biography of author
The first topic he introduces is Bell Numbers, that I've certainly heard about, but never understood. The problem with my current approach to number theory (whereby I look at the mathematical significance of my diurnal age) is that it's rather discursive. I come into contact with a broad range of concepts but don't pursue them in any great depth.

If I could work my way further into this book, I might be able to remedy that. Anyway, I now understand Bell Numbers and I'll try to present what I've found out about them here and hopefully include some practical applications that a little research may throw up. The Bell numbers arise from a simple enough problem. Suppose we have a group of six people that we shall label 1, 2, 3, 4, 5, 6. These six people can make up the set A = {1, 2, 3, 4, 5, 6}. We ask the question: in how many ways can we arrange these six people into groups with no person able to be in more than one group? A group can consist of between one and six members.

Figure 3: I downloaded and collected this group of six characters using SketchUp

The author starts off by looking at small sets. One person can be placed in only one group obviously but two people can be placed into groups in two different ways, either together 1, 2 or separately 1|2. For three people, there are five possibilities:

1, 2, 3 or 1|2, 3 or 2|1, 3 or 3|1, 2 or 1|2|3

These are the first three Bell numbers named after Eric Temple Bell (1883-1960), Scottish mathematician, writer and early science fiction author. Thus:$$B_1=1 \text{ and } B_2=2 \text{ and } B_3=5$$I'll quote directly from the book here and he explains how to derive a general recursive formula for the Bell numbers:
As n grows, it is becoming harder and harder to calculate the Bell numbers by simply listing the partitions, so we must find a simpler way. To do this, we consider the following method. Let us fix an n-set A, and we pick out an arbitrary element a from that of n. If we consider all the partitions of A, there will be n possible cases: the element a is in a block of k elements, where k can be 1, 2, . . . , n. The first possibility, when k = 1, results in the block {a}. When a is in a two-element block, say, in {a, b}, then we have to choose the element b beside a. This can be done in \(n − 1 =  \binom{n-1}{1} \) ways. If a is contained in a block of three elements, then we have to choose two elements beside a on \( \binom{n-2}{2} \) ways. And so on, until arriving k = n: if a is contained in an n-block (i.e., the partition contains one block and this is the whole A), then we have to choose n−1 elements beside a. This is possible just in \( \binom{n-1}{n-1}= 1 \) way. After n−1 fixing the size k of the block of a, we can focus on the remaining elements not in the block of a. We see that the remaining n−k elements can be partitioned arbitrarily and the total number of these partitions is \(B_{n−k} \) by the definition of the Bell numbers. Hence, for any single k there are \( \binom{n-1}{n-k} B_{n-k}\) cases. We can sum up the possible values of k, because these cases are pairwise disjoint. Hence we have:
$$B_n=1 \, . B_{n-1}+\binom{n-1}{1} \,.B_{n-2}+\binom{n-2}{2} \, . B_{n-3} + \dots + \binom{n-1}{n-1} \, . 1$$For consistency in the previous formula, we can replace the initial 1 with \( \binom{n-1}{0}\) and the final 1 with \(B_0=1\). This produces:$$B_n=\binom{n-1}{0} \, . B_{n-1}+\binom{n-1}{1} \,.B_{n-2}+\binom{n-2}{2} \, . B_{n-3} + \dots + \binom{n-1}{n-1} \, . B_0$$This can be written more succinctly as:$$B_n=\sum_{k=0}^{n-1} \binom{n-1}{k} \, .B_{n-k-1}$$Using the fact that \( \binom{n}{k}=\binom{n}{n-k} \) and \( \binom{n-1}{k}=\binom{n-1}{n-1-k} \), we can then write:$$B_n=\sum_{k=0}^{n-1} \binom{n-1}{n-1-k} \, .B_{n-1-k}=\sum_{k=0}^{n-1} \binom{n-1}{k} \, .B_{k}$$The recursive formula on the right enables us to find other Bell numbers. We already know that \(B_0=1, B_1=1, B_2=2 \text{ and } B_3=5 \) and so:$$B_4=\sum_{k=0}^{4-1} \binom{4-1}{k} \, .B_k=\binom{3}{0} \, . B_0+ \binom{3}{1} \, . B_1+\binom{3}{2} \, . B_2+\binom{3}{3} \, . B_3= 15$$Continuing this process, we get \(B_5=52\) and \(B_6=203\) and thus:

Question: in how many ways can we arrange these six people into groups with no person able to be in more than one group?

Answer: 203.

There is however, an easier way to generate the Bell numbers if we don't want to concern ourselves with theoretical justification. It involves use of the so-called Bell triangle, explained by Wikipedia in full but just shown below as it's pretty self-explanatory:
Here are the first five rows of the triangle constructed by these rules: 
 1
  2
 2   3   5
   7  10  15
15  20  27  37  52 
The Bell numbers appear on both the left and right sides of the triangle.
Mezö's approach to deriving the Bell numbers, as outlined above, involves the use of Stirling numbers of the second kind. These are simply the components of the summation that were obtained from the different values of k. The symbol used is:$$\begin{Bmatrix}
           n \\         
           k \\
          \end{Bmatrix}$$It represents how many groups of k can be formed from n elements. For example, take the case of n=4 and k=2. Suppose A = {a, b, c, d}, then we have the following seven possibilities:

1|2,3,4   2|1,3,4   3|1,2,4   4|1,2,3   1,2|3,4   1,3|2,4   1,4|2,3
$$\text{Thus }\begin{Bmatrix}
           4 \\         
           2 \\
          \end{Bmatrix}=7 \text{ and likewise }\begin{Bmatrix}
           4 \\         
           1 \\
          \end{Bmatrix}=1 \, , \begin{Bmatrix}
           4 \\         
           3 \\
          \end{Bmatrix}=6 \text{ and }\begin{Bmatrix}
           4 \\         
           4 \\
          \end{Bmatrix}=1$$ $$ \text{Thus we can say that } B_n=\begin{Bmatrix}
           n \\         
           1\\
          \end{Bmatrix}+\begin{Bmatrix}
           n \\         
           2 \\
          \end{Bmatrix}+ \cdots +\begin{Bmatrix}
           n \\         
           n \\
          \end{Bmatrix}$$That's as far as I'll pursue the Stirling numbers here but I'd like to now look at some of the practical applications for Bell numbers. Wikipedia provides two examples:
Factorisations
If a number N is a square-free positive integer (meaning that it is the product of some number n of distinct prime numbers), then Bn gives the number of different multiplicative partitions of N. These are factorisations of N into numbers greater than one, treating two factorisations as the same if they have the same factors in a different order. For instance, 30 is the product of the three primes 2, 3, and 5, and has B3 = 5 factorisations:$$30=2\times 15=3\times 10=5\times 6=2\times 3\times 5$$Rhyme schemes
The Bell numbers also count the rhyme schemes of an n-line poem or stanza. A rhyme scheme describes which lines rhyme with each other, and so may be interpreted as a partition of the set of lines into rhyming subsets. Rhyme schemes are usually written as a sequence of Roman letters, one per line, with rhyming lines given the same letter as each other, and with the first lines in each rhyming set labeled in alphabetical order. Thus, the 15 possible four-line rhyme schemes are AAAA, AAAB, AABA, AABB, AABC, ABAA, ABAB, ABAC, ABBA, ABBB, ABBC, ABCA, ABCB, ABCC, and ABCD.
Bell numbers can be prime and thus there are Bell primes. The first few are:$$B_2=2 \, ,B_3=5 \, , B_7=877 \text{ and }B_{13}=27644437$$The indices are prime as well but this is not always the case as the next two indices yielding prime numbers are 42 and 55 (and very large primes they are too). Bell is famous for his somewhat flawed 1937 book "Men of Mathematics" but he also wrote science fiction novels under the name John Taine.

Figure 4: cover of Bell's book

For some interesting biographical details on E. T. Bell, follow this link. There is an interesting comment made in A History of Mathematics: From Mesopotamia to Modernity by Luke Hodgkin (2005):
The fact that Wiles was stimulated in childhood by E. T. Bell's romantic personalized anecdotal book Men of Mathematics to nurse an ambition to solve the problem Fermat's Last Theorem is in itself an index of the power which a certain view of the history of mathematics can exercise.
On page 413 of Combinatorics and Number Theory of Counting Sequences, the author provides a table of the initial Bell numbers. This is shown in Figure 5:

Figure 5: the initial Bell numbers

Tuesday, 1 January 2019

Sphenic Numbers Revisited

After this post, I discovered that I'd already made an earlier post about sphenic numbers. No matter but it alerted me to the fact that I've made so many posts to this mathematics blog that I'm losing track of what I've posted.

Today I turned 25474 days old. This number factors to 2 * 47 * 271. Yesterday's number, 25473, factors to 3 * 7 * 1213. Both are sphenic numbers, described by Numbers Aplenty as follows:
A number \(n\) is called sphenic if it is the product of 3 distinct primes. For example, 370 is a sphenic number because it is the product of the 3 primes 2, 5 and 37. Sphenic numbers are quite common: up to \(10^8\) there are 20710806 sphenic numbers (that's about 20%). 
The sum of the reciprocals of the sphenic numbers diverges, while the sum of the reciprocal of their squares converges to \(0.003696244...\), which can be expressed as: $$ \frac{(P(2)^3-3 \, P(2) \, P(4)+2 \,P(6))}{6}\\ \text { where }P(s)=\sum_{p\mathrm{\ prime}}\frac{1}{p^s}$$ is the so-called prime Zeta function. 
The first sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310
Wikipedia adds that:
All sphenic numbers have exactly eight divisors. If we express the sphenic number as \( n = p \cdot q \cdot r\) where \(p\), \(q\), and \(r\) are distinct primes, then the set of divisors of \(n\) will be \({1, p, q, r, pq, pr, qr, n}\). The converse does not hold. For example, 24 is not a sphenic number, but it has exactly eight divisors. 
All sphenic numbers are by definition squarefree, because the prime factors must be distinct. 
The first case of two consecutive sphenic integers is 230 = 2×5×23 and 231 = 3×7×11. The first case of three is 1309 = 7×11×17, 1310 = 2×5×131, and 1311 = 3×19×23. There is no case of more than three, because every fourth consecutive positive integer is divisible by 4 = 2×2 and therefore not squarefree. 
The numbers 2013 (3×11×61), 2014 (2×19×53), and 2015 (5×13×31) are all sphenic. It's interesting that these very recent calendar years formed a sphenic triplet, although I didn't know it at the time I was living through them. The next three consecutive sphenic years will be 2665 (5×13×41), 2666 (2×31×43) and 2667 (3×7×127) (see OEIS A248202 for a list of the central number of such triples). 
Sphenic Brick
In terms of geometry, each sphenic number can be considered to represent the volume of a unique and "primitive" rectangular prism (sometimes called a sphenic brick) whose dimensions are given by its three prime factors. I'm using primitive here in the same sense as "primitive Pythagorean triad" such as 3, 4 and 5 (as opposed to 6, 8 and 10). By its definition however, a sphenic number can never represent the volume of a cube or a rectangular prism with a square cross-section.

Each sphenic number \( n = p \cdot q \cdot r\) can be associated with another number, namely the surface area of the rectangular prism  \( 2 \, (p \cdot q + p \cdot r+q \cdot r) \). For example, the sphenic number  \( 7429 = 17 \cdot 19 \cdot 23\) can be viewed as a rectangular prism with an associated surface area of \(2302\) square units. The ratio between area and volume can then be explored. The table below shows the values of such ratios for sphenic numbers between 25400 and 25500:


It is possible for the volume and surface area to be equal. In a range of numbers between 1 and 1000, the only such dimensions that produce this are:
  • 3 x 7 x 42   --> 882 
  • 3 x 8 x 24   --> 576
  • 3 x 9 x 18   --> 486
  • 3 x 10 x 15 --> 450
  • 4 x 5 x 20   --> 400
  • 4 x 6 x 12   --> 288
Whether these are the only values with this property I don't know but none of the above numbers (288, 400, 450, 486, 576 and 882) are sphenic so it's likely that there are no sphenic numbers with this property.

To determine the sphenic numbers within a given range, this SageMath code (link to SageMathCell server) can be used or the box below (sometimes temperamental) can be experimented with:


Monday, 25 June 2018

Sphenic Numbers

Today I turned 25285 days old and, as I discovered in Numbers Aplenty, 25285 is a sphenic number. The definition given on that site is:
A number \(n\)  is called sphenic if it is the product of 3 distinct primes. 
For example, 370 is a sphenic number because it is the product of the 3 primes 2, 5 and 37. 
Sphenic numbers are quite common: up to  \(10^8\) there are 20,710,806 sphenic numbers. 
The sum of the reciprocals of the sphenic numbers diverges, while the sum of the reciprocal of their squares converges to 0.003696244... , which can be expressed as  \((P(2)^3-3\,P(2)\,P(4)+2\,P(6))/6\), where $$P(s)=\sum_{p\mathrm{\ prime}}\frac{1}{p^s}$$is the so-called prime Zeta function 
The first sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310
The sum of the reciprocals of the squares of the sphenic numbers does indeed approach 0.003696244 as can be seen by taking the numbers from 30 to 310 and applying the following SAGE code:
INPUT: 
sphenic=[30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310]
sum=0
for n in sphenic:
    sum+=1/n^2
print(sum.n())
OUTPUT: 
0.00320320889263633 

The following is a modification of the Wikipedia entry for sphenic numbers:
In number theory, a sphenic number is a natural number|positive integer that is the product of three distinct prime numbers. Thus a sphenic number is a product ''pqr'' where ''p'', ''q'', and ''r'' are three distinct prime numbers. This definition is more stringent than simply requiring the integer to have exactly three prime factors. For instance, \(60 = 2^2 × 3 × 5 \) has exactly 3 prime factors, but is not sphenic. 
The smallest sphenic number is 30 = 2 × 3 × 5, the product of the smallest three primes. The largest known sphenic number is
$$(2^{77232917}− 1) \cdot (2^{74,207,281} − 1) \cdot (2^{57,885,161} − 1)$$It is the product of the three largest known primes. 
All sphenic numbers have exactly eight divisors.  If we express the sphenic number as \(n = p \cdot q \cdot r \), where ''p'', ''q'', and ''r'' are distinct primes, then the set of divisors of ''n'' will be { 1, p, q, r, pq, pr, qr, n }. 
The converse does not hold. For example, 24 is not a sphenic number, but it has exactly eight divisors. 
All sphenic numbers are by definition squarefree, because the prime factors must be distinct. 
The Möbius function of any sphenic number is -1. 
The first case of two consecutive sphenic integers is 230 = 2×5×23 and 231 = 3×7×11. The first case of three is 1309 = 7×11×17, 1310 = 2×5×131, and 1311 = 3×19×23. There is no case of more than three, because every fourth consecutive positive integer is divisible by 4 = 2×2 and therefore not square-free. 
The numbers 2013 (3×11×61), 2014 (2×19×53), and 2015 (5×13×31) are all sphenic. The next three consecutive sphenic years will be 2665 (5×13×41), 2666 (2×31×43) and 2667 (3×7×127) (see OEIS A165936).
The OEIS sequence A007304 (sphenic numbers, products of 3 distinct primes) mentions that a sphenic brick is a rectangular parallelopiped whose sides are components of a sphenic number, namely whose sides are three distinct primes. For example, the distinct prime triple (3,5,7) produces a 3 x 5 x 7 unit brick which has volume 105 cubic units. 


From my early days of investigating numbers, I had considered triprimes (number that factor into three, not necessarily distinct, primes) as having unique representations as rectangular prisms. I was interested in the relationship between a prisms volume and its surface area, coining the term "cubicity". Here is a snapshot of a February 2014 Instagram post: