Wednesday, 27 April 2022

POBA: Primes Only Best Approximate

It takes a little getting used to the concept of what a POBA or Primes Only Best Approximate is. One definition runs:

"Suppose that \( x > 0 \). A fraction \( p/q \) of primes is a primes-only best approximate (POBA), and we write "\( p/q \) in B( \( x \) )", if \(0 < |x - p/q| < |x - u/v| \) for all primes \(u\) and \(v\) such that \(v < q\), and also, \( |x - p/q| < |x - p'/q|  \) for every prime \(p'\) except \(p\). Note that for some choices of \(x\), there are values of \(q\) for which there are two POBAs. In these cases, the greater is placed first; e.g., B(3) = (7/2, 5/2, 17/5, 13/5, 23/7, 19/7, ...)." 

Things become clearer if we look at a specific example. On April 23rd 2022, I turned 26683 days old and one of the properties of this number is that it's a member of OEIS A265788:


 A265788

Numerators of primes-only best approximates (POBAs) to \( \sqrt{5} \).          


The POBAs to start with are 3/2, 5/2, 7/3, 11/5, 29/13, 163/73, 199/89, 521/233. The initial members of the sequence are thus 3, 5, 7, 11, 29, 163, 199, 521 (with the continuation being 3571, 26683, 111667, 150427, 154841 etc.). Table 1 shows the initial approximations:


Table 1: permalink POBAs for \( \sqrt{5}\)

The convergence is far slower than with the continued fraction  where the numerator and denominator of each fraction are coprime. See Table 2 and note that scientific notation is used once the difference becomes very small.


Table 2: permalink continued fraction approximations for \( \sqrt{5} \)

The SageMath algorithm I developed is rather sluggish but it can be easily modified to accommodate other irrational or transcendental numbers such as \( \pi \). See Table 3 for the POBAs for \( \pi \).


Table 3: permalink POBAs for \( \pi \)

Once again, the continued fractions are far more efficient and the display quickly changes to scientific notation because of the small differences. See Table 4 for the continued fraction approximations of \( \pi \).


Table 4: permalink continued fraction approximations for \( \pi \)

Let's not forget that the continued fractions for irrational and transcendental numbers offer the best approximations. While the POBAs are clearly less efficient, they are nonetheless interesting in their own right. Further variations can be envisaged such as fractions whose numerators and denominators consist of only Fibonacci numbers rather than primes.

Tuesday, 19 April 2022

1-2-3 Primes and Beyond

What do I mean by a 1-2-3 prime? Well, let's use 13 and an example because this is the first 1-2-3 prime. The name is given because this prime and the subsequent two numbers can be written in a special way, namely:$$ \begin{align} 13&= 1 \times 13\\14& = 2 \times 7\\15&=3 \times 5 \end{align}$$The 1-2-3 primes constitute OEIS A163573:


 A036570



Primes \(p\) such that \( \dfrac{p+1}{2} \) and \( \dfrac{ p+2}{3} \) are also primes.       
                             

The initial members are:

13, 37, 157, 541, 877, 1201, 1381, 1621, 2017, 2557, 2857, 3061, 4357, 4441, 5077, 5581, 5701, 6337, 6637, 6661, 6997, 7417, 8221, 9181, 9661, 9901, 10837, 11497, 12457, 12601, 12721, 12757, 13681, 14437, 15241, 16921, 17077, 18217

Looking at the second member of the sequence, 37, it can seen that: $$ \begin{align} 37&= 1 \times 37\\38& = 2 \times 19\\39&=3 \times 13 \end{align}$$By a 1-2-3-4 prime, I mean a prime such as 12721 where this prime and the subsequent three numbers can be written in a special way, namely:$$ \begin{align} 12721&= 1 \times 12721\\12722& = 2 \times 6361\\12723&=3 \times 4261\\ 12724 &=4 \times 3181 \end{align}$$The 1-2-3-4 primes constitute OEIS A036570:


 A163573

Primes \( p \) such that \( \dfrac{p+1}{2} \),  \( \dfrac{p+2}{3} \) and  \( \dfrac{p+3}{4} \) are also primes.               


The initial members of the sequence are:

12721, 16921, 19441, 24481, 49681, 61561, 104161, 229321, 255361, 259681, 266401, 291721, 298201, 311041, 331921, 419401, 423481, 436801, 446881, 471241, 525241, 532801, 539401, 581521, 600601, 663601, 704161, 709921, 783721, 867001, 904801

Looking at the second member of the sequence, 16921, it can be seen that:$$ \begin{align} 16921&= 1 \times 16921\\16922& = 2 \times 8461\\16923&=3 \times 5641\\ 16921 &=4 \times 4231 \end{align}$$The comments to the second OEIS sequence state that all terms are of the form \(120k+1 \), which is why they all end 1. This makes it easy to find the increasingly rare 1-2-3-4-5 and 1-2-3-4-5-6 primes because the sequence will be:$$\begin{align} \frac{120k+1}{1}&=120k+1\\ \frac{120k+2}{2}&=60k+1\\ \frac{120k+3}{3}&=40k+1\\ \frac{120k+4}{4}&=30k+1\\ \frac{120k+5}{5}&=24k+1\\ \frac{120k+6}{6}&=20k+1 \end{align}$$All we need so then is to check each of the \(k\) expressions for primeness. So, armed with this knowledge, let's look for 1-2-3-4-5 and 1-2-3-4-5-6 primes. Starting with the former, we find the following after testing for values of  \(k\) up to 10,000:
  • [19441, 9721, 6481, 4861, 3889]
  • [266401, 133201, 88801, 66601, 53281]
  • [423481, 211741, 141161, 105871, 84697]
  • [539401, 269701, 179801, 134851, 107881]
  • [600601, 300301, 200201, 150151, 120121]
  • [663601, 331801, 221201, 165901, 132721]
  • [908041, 454021, 302681, 227011, 181609]
  • [1113961, 556981, 371321, 278491, 222793]
The initial 1-2-3-4-5 primes are:
[19441, 266401, 423481, 539401, 600601, 663601, 908041, 1113961]

These terms form part of OEIS A204592:


 A204592

Primes \(p\) such that \( \dfrac{p+1}{2} \), \( \dfrac{p+2}{3} \), \( \dfrac{p+3}{4} \) and \( \dfrac{p+4}{5} \) are also prime.      


Here are more terms:

19441, 266401, 423481, 539401, 600601, 663601, 908041, 1113961, 1338241, 1483561, 1657441, 1673401, 2578801, 3109681, 3150841, 3336601, 3613681, 4112761, 4160641, 4798081, 5114881, 5412961, 5516281, 5590201, 5839681, 6078361, 7660801, 8628481, 9362641, 9388801, 9584401, 9733081

To find the initial 1-2-3-4-5-6 primes, the value of \(k\) must be set much higher. Here is what we find for values of \(k\) up 1,000,000:
  • [5516281, 2758141, 1838761, 1379071, 1103257, 919381]
  • [16831081, 8415541, 5610361, 4207771, 3366217, 2805181]
  • [18164161, 9082081, 6054721, 4541041, 3632833, 3027361]
  • [29743561, 14871781, 9914521, 7435891, 5948713, 4957261]
  • [51755761, 25877881, 17251921, 12938941, 10351153, 8625961]
The initial 1-2-3-4-5-6 primes are:
[5516281, 16831081, 18164161, 29743561, 51755761]

These terms form part of OEIS


 A208455

Primes \(p\) such that \( \dfrac{p+k}{k+1}\) is a prime number for \(k=1, \dots,5\).                   


Here are some more terms in the sequence:

5516281, 16831081, 18164161, 29743561, 51755761, 148057561, 153742681, 158918761, 175472641, 189614881, 212808961, 297279361, 298965241, 322030801, 467313841, 527428441, 661686481, 668745001, 751524481, 808214401

Here is a SageMathCell permalink that can be used to determine these primes.

Monday, 18 April 2022

Factorions

Figure 1

On Chris Pickover's Twitter feed, I came across the factorion, a term he uses to describe numbers of the form 145 where 1! + 4! + 5! = 145. Figure 1 shows his tweet. He defines a factorion as a natural number that equals the sum of the factorials of its digits. There are only two of these: 145 and 40585. 

Drawing on an analogy to amicable numbers, Wikipedia introduces the term amicable factorions to describe a pair of numbers in which the factorial digit sum of one number equals the other number. The two such pairs of numbers are (871, 45361) and (872, 45362). 

871 --> 45361 --> 871

872 --> 45362 --> 872

Again, in keeping with the analogy to sociable numbers, Wikipedia introduces the term sociable factorians to describe numbers that eventually return to themselves after repeated applications of the factorial sum of digits. Examples are 169, 363601 and 1454 where:

169 --> 363601 --> 1454 --> 169

These three numbers can be said to have a cycle length of three and thus amicable factorions could be considered as sociable factorions with a cycle length of 2. Similarly factorians could be viewed as sociable factorions with a cycle length of 1.

Thus factorions of whatever ilk are few and far between. The list comprises only:

  • 145 factorion
  • 169 sociable factorion
  • 871 amicable factorion
  • 872 amicable factorion
  • 1454 sociable factorion
  • 40585 factorion
  • 45361 amicable factorion
  • 45362 amicable factorion
  • 363601 sociable factorion
Thus the largest factorion, 363601, has six digits. A factorion could, theoretically, have seven digits because the smallest seven digit number is 1,000,000 and the largest factorial digit sum of a seven digit number is 7 x 9! = 2,540,160. However, factorions of eight digits and beyond are not possible because the smallest eight digit number is 10,000,000 and the largest factorial digit sum of an eight digit number is 8 x 9! = 2,903,040. Let's not forget that 0! = 1 by the way.

The Wikipedia articles looks at the topic using more mathematical terminology and considers number bases other than 10 but I'll keep this post simple (and I'm feeling lazy). Here is permalink to the SageMath algorithm that generates the above list. Below I've embedded the SageMath code:

Wednesday, 13 April 2022

Mathematica and the Raspberry Pi


Figure 1

When I first looked at the applications that are preinstalled on my recently purchased Raspberry Pi, I noticed an icon for Mathematica but assumed it was just a promotional link. I'd completely forgotten that Mathematica comes preinstalled with every Raspberry Pi. As it says on this site:

Mathematica is a computational programming tool used in science, maths, computing and engineering. It was first released in 1988. It is proprietary software that you can use for free on the Raspberry Pi and comes bundled for free with Raspbian. Mathematica is generally used for coding projects at university level and above.

Figure 1 shows a screenshot of the setup on my laptop. So far I've been using SageMath for my mathematical calculations but it will be interesting to experiment with Mathematica now that I have acquired it for free. Figure 2 shows a detail from Figure 1.


Figure 2

So far I've only taken baby steps and have learned to:

  • How to launch the Mathematica notebook and run commands
  • How to use variables
  • How to use symbolic values for irrational numbers like Pi
  • How to use lists, ranges, tables and loops
  • How to use and and search for built-in functions
  • How to save a Wolfram script and run it from the command line
  • How to perform list operations
  • How to use Matrices
  • How to plot in 3D

I'm looking forward to becoming more proficient and hopefully I can document some of my progress in future blog posts.

Saturday, 2 April 2022

26662

Well, not only is my diurnal age today (April 2nd 2022) an impressive palindrome (26662) but the date also marks my 73rd solar return. This is the day that the Sun returns to the exact position that it occupied at the time of my birth, namely 12°47'07" of Aries. The date of the solar return is always close to a person's official birthday but not necessarily the same as it. In my case, April 3rd is my official birthday.


I'll use this number as an excuse to revisit some mathematical topics that I haven't visited in quite a while. Let's begin:

COLLATZ TRAJECORY

What is the trajectory of 26662 under the 3\(x\)+1 recursive algorithm? The algorithm is applied to any positive integer \(n\):

\(n\) → \(n\)/2 (n is even)

\(n\) → 3\(n\) + 1 (n is odd)

Most, but not all, numbers reach 1. 26662 is no exception but it takes 95 steps. It's trajectory is:

26662, 13331, 39994, 19997, 59992, 29996, 14998, 7499, 22498, 11249, 33748, 16874, 8437, 25312, 12656, 6328, 3164, 1582, 791, 2374, 1187, 3562, 1781, 5344, 2672, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1

Figure 1 shows a plot of these values:


Figure 1

ALIQUOT SEQUENCE

The aliquot sequence for an integer \(n\) is obtained from the recurrence relation:$$a_n=\sigma(a_{n-1})-a_{n-1}$$where \( \sigma(n) \) is the sum of divisors function. Most aliquot number sequences reach 0 but if an amicable number is encountered then it ends up alternating between the abundant and deficient member of the amicable pair. Such is the case with 26662 where the amicable number pair (2924, 2620) is reached. Here is the trajectory:

26662 --> 13334 --> 7186 --> 3596 --> 3124  --> 2924 --> 2620 --> 2924

ANTI-DIVISORS

While 26662 may only have four divisors (1, 2, 13331 and 26662), it has a larger number of anti-divisors. These are:

3, 4, 5, 9, 15, 25, 27, 45, 75, 79, 135, 225, 237, 395, 675, 711, 1185, 1975, 2133, 3555, 5925, 10665, 17775

I've made two posts about anti-divisors. One is titled Anti-divisors on February 26th 2016 and another, more comprehensive, post on February 28th 2021 titled More on Anti-divisors.

ARITHMETIC DERIVATIVE

The arithmetic derivative of a natural number \(n\) is given by:$$ \begin{align} p'&=1 \text{ for any prime }p\\(pq)'&=p'q+pq' \text{ for any } p,q \in \mathbb{N } \end{align}$$The arithmetic derivative of 26662 is thus:$$ \begin{align}  26662'  &= (2 \times 13331)'\\&= 2' \times 13331 + 2 \times 13331'  \\&= 13331+2\\&=13333\end{align}$$

DIGIT MANIPULATION

Suppose we have a number such as 26662 and we want to rearrange its digits in such a way that the maximum and minimum possible numbers are created. This would give us 66622 as a maximum and 22666 as a minimum. Furthermore, let’s suppose we want to subtract the minimum from the maximum to get 43956 and then repeat this digital manipulation repeatedly until some resolution is reached. 

In this case, the trajectory of 26662 looks like this: 

26662 --> 43956 --> 61974 --> 82962 --> 75933 -->  63954 --> 61974

As can be seen, a loop has been entered {61974, 82962, 75933, 63954}. Most numbers enter a loop but sometimes 0 is reached if a number like 999 is encountered.

GOLDBACH DECOMPOSITION

Goldbach’s conjecture states that every even number can be expressed as a sum of two primes. There are many such decompositions for any given number (see my post Goldbach’s Conjecture Revisited) but the one containing the smallest and largest prime is known as the minimal decomposition.

There are 439 Goldback decompositions of 26662

The minimal decomposition is (24593, 2069)

HOME PRIME

The home prime of a number n is the prime reached by concatenating its prime factors (in the order smallest to largest) and repeating until a prime is reached. In the case of 26662, only three steps are required:

26662 = 2 x 13331 --> 213331 = 383 x 557 --> 383557

MULTIPLICATIVE PERSISTENCE

The multiplicative persistence of a number counts the number of steps required to reach a fixed number (often zero) when the digits are multiplied together. 26662 has a multiplicative persistence of 4:

26662 --> 864 --> 192 --> 18 --> 8

A variation of this, that I came up with, is to add this product to the original number. So the 864 from the initial product of digits is added to 26662 to give 27526 and this process is repeated until a number with a zero is reached, after which there can be no further change. The trajectory for 26662 is:

26662 --> 27526 --> 28366 --> 30094

ODDS 'n EVENS

This algorithm takes a number and applies the following recursive process to the number: add the sum of its odd digits to the number and subtract the sum of the even digits, repeating this process until a stable number is reached.  The trajectory of 26662 is as follows:

26662 --> 26640 --> 26622 --> 26604 --> 26586 --> 26569 --> 26569

Thus 26662 is a captive of the attractor 26569 that has a total of 92 captives.

PALINDROME

26662 is of course a palindrome but it has the interesting property that its two prime factors (2 and 13331) are also palindromic (2 of course trivially so). 26662 is also palindromic in base 8 (64046).

I'll leave off there but this post was useful for me in that I was reminded of many concepts that I hadn't encountered in quite a while. I simply made my way through my Google document where I've recorded these concepts over the past few years and applied them to this particular number. It's something that I should do on a regular basis, perhaps even writing a program that would automatically generate this information for a given number. That would be useful!

ADDENDUM: added April 7th 2022

In fact, I did write such a program as alluded to in the paragraph above. Here is a permalink to SageMathCell using 26667 as an example. The output is:

The Collatz Trajectory for 26667 is:
[26667, 80002, 40001, 120004, 60002, 30001, 90004, 45002, 22501, 67504, 33752, 16876, 8438, 4219, 12658, 6329, 18988, 9494, 4747, 14242, 7121, 21364, 10682, 5341, 16024, 8012, 4006, 2003, 6010, 3005, 9016, 4508, 2254, 1127, 3382, 1691, 5074, 2537, 7612, 3806, 1903, 5710, 2855, 8566, 4283, 12850, 6425, 19276, 9638, 4819, 14458, 7229, 21688, 10844, 5422, 2711, 8134, 4067, 12202, 6101, 18304, 9152, 4576, 2288, 1144, 572, 286, 143, 430, 215, 646, 323, 970, 485, 1456, 728, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1]
There are 170 steps required to reach 1

The Aliquot Sequence for 26667 is:
[26667, 11865, 10023, 4425, 3015, 2289, 1231, 1, 0]

The Anti-Divisors of 26667 are:
[2, 5, 6, 7, 18, 19, 133, 401, 2807, 5926, 7619, 10667, 17778]

The Arithmetic Derivative of 26667 is 17787

The Maximum - Minimum Recursive Algorithm for 26667 produces:
[26667, 49995, 53955, 59994, 53955]

There are no Goldback Decompositions of 26667 because it is odd.

number of steps required is to reach home prime is 6 :
[26667, 332963, 378999, 33334679, 733114387, 2969246923]

The multiplicative persistence of 26667 is as follows:
[26667, 3024, 0]

26667 has Odds and Evens Trajectory of length 6 and is:
[26667, 26654, 26641, 26624, 26604, 26586, 26569, 26569]