Showing posts with label run. Show all posts
Showing posts with label run. Show all posts

Friday, 7 March 2025

Runs of Semiprimes

A little investigation has revealed that there are record runs of eight semiprimes that are each separated by one number or, to put it another way, the semiprimes form an arithmetic progression with a common difference of 2. In the range up to half a million, there are four groups of eight such semiprimes. All the numbers are odd because every fourth number is a multiple of 4 and so no such runs of eight even numbers are possible. The reason that the limit is eight semiprimes is that every ninth number is a multiple of 9. The groups are (permalink):

  • 8129 ... 8143 (see Table 1)
  • 237449 ... 237463 (see Table 2
  • 401429 ... 401443 (see Table 3)
  • 452639 ... 452653 (see Table 4)
The details are (permalink):

Table 1: permalink


Table 2: permalink


Table 3: permalink



Table 4: permalink

As I later discovered, these four numbers form the initial terms of OEIS A217222.


A217222
    Initial terms of sets of 8 consecutive semiprimes with gap 2.


The initial terms are:

8129, 237449, 401429, 452639, 604487, 858179, 1471727, 1999937, 2376893, 2714987, 3111977, 3302039, 3869237, 4622087, 7813559, 9795449, 10587899, 10630739, 11389349, 14186387, 14924153, 15142547, 15757337, 18017687, 18271829, 19732979, 22715057, 25402907

Here are the OEIS comments:
  • All terms == 11 (mod 18).
  • Also all terms of sets of 8 consecutive semiprimes are odd, e.g., {8129, 8131, 8133, 8135, 8137, 8139, 8141, 8143} is the smallest set of 8 consecutive semiprimes.
  • Note that in all cases "9th term" (in this case 8143+2=8145) is divisible by 9 and hence is not semiprime.
  • Also note that all seven "intermediate" even integers (in this case {8130, 8132, 8134, 8136, 8138, 8140, 8142}) have at least three prime factors counting with multiplicity. Up to n = 40*10^9 there are 5570 terms of this sequence.
There is another sequence, of which OEIS A217222 is a subsequence, wherein an even semiprime is contained in the run of eight odd semiprimes. This is OEIS A082919.


A082919    Numbers k such that k, k+2, k+4, k+6, k+8, k+10, k+12 and k+14 are semiprimes.


The initial members of this sequence are (members of A217222 are shown in blue):

8129, 9983, 99443, 132077, 190937, 237449, 401429, 441677, 452639, 604487, 802199, 858179, 991289, 1471727, 1474607, 1963829, 1999937, 2376893, 2714987, 3111977, 3302039, 3869237, 4622087, 4738907, 6156137, 7813559, 8090759

Take 9983 as an example. There is still the run of eight odd semiprimes but, between 9985 and 9987, there is 9986 which is also a semiprime. In all the non-blue numbers above, there is only the one even semiprime in the range of 14 numbers, making for a total of nine semiprimes. See Table 5:

Table 5

Here are some of the OEIS comments for this sequence:
  • All terms == 11 (mod 18). - Zak Seidov, Sep 27 2012
  • There is at least one even semiprime between k and k+14 for 1812 of the first 10000 terms. - Donovan Johnson, Oct 01 2012
  • All terms == {29,47,83} (mod 90). - Zak Seidov, Sep 13 2014
  • Among the first 10000 terms, from all 80000 numbers a(n)+m, m=0,2,4,6,8,10,12,14, the only square is a(4637) + 2 = 23538003241 = 153421^2 (153421 is prime, of course). - Zak Seidov, Dec 22 2014

Sunday, 2 March 2025

Gray Code Niven Numbers

Let's recall a few facts. A Harshad or Niven number is a number that is divisible by its sum of digits. For example, 21 has a sum of digits of 3 and 3 divides 21 to give 7. Thus 21 is a Niven number, at least in base 10. What about in other bases? Well, in base 7, 21 can be represented as 30 with a sum of digits of 3 again. So 21 is a Niven number in base 7 as well. What about in base 2 where it has a representation of 10101. Again the sum of digits is 3 and thus 21 is also a Niven number in base 2. Of course, 21 is not a Niven number in all bases. In base 8, the number is represented as 25 with a sum of 7 which does not divide into it.


Source

Now I've written about Gray Code in an eponymous post on 18th June 2023 so I won't go into the topic again here. Suffice to say that to generate the Gray Code of a number we convert it to binary and make certain changes to the binary digits. Let's illustrate this by way of the number associated with my diurnal age today, 27727. It's binary representation is 110110001001111 and the Gray Code equivalent is 101101001101000. Now how many 1's are there in the latter. There are seven which corresponds of course to its digit sum. Now 7 divides 27727 because its factorisation is 7 x 17 x 233. So 27727 with its digit sum of 25 is not a Niven number in base 10. Nor is it a Niven number in base 2 where there are nine 1's. However, it is a Gray Code Niven number!

These sorts of numbers caught my attention because of OEIS A344344:


A344344  Starts of runs of 4 consecutive Gray-code Niven numbers (A344341: Gray-code Niven numbers: numbers divisible by the number of 1's in their binary reflected Gray code (A005811)).

Figure 1 shows the results for the four consecutive numbers (permalink):


Figure 1

The initial members of OEIS A344344 are:

1, 6, 30, 126, 510, 543, 783, 903, 2046, 2093, 3773, 3903, 7133, 7743, 8190, 8223, 8703, 10087, 12303, 12543, 14343, 14463, 15423, 15903, 16143, 16263, 20167, 22687, 27727, 30247, 30653, 30783, 32766, 35629, ...

Saturday, 12 October 2024

Record Runs Involving Home Primes

I just happened to notice that there is a run of six consective numbers from 27597 to 27602 inclusive that are only one step removed from their home primes. The only longer run up to one million that occurs is a run of eight numbers from 45162 to 45169.

Here is a permalink for finding these runs. Currently I'm 27586 days old and so the coming record run is not far off. Here are the factorisations for the numbers and the home primes associated with them.

  • \(27597 = 3 \times 9199 \rightarrow 39199\)

  • \(27598 = 2  \times13799 \rightarrow 213799 \)

  • \(27599 = 11 \times 13 \times 193 \rightarrow 1113193 \)

  • \(27600 = 2^4 \times 3 \times 5^2 \times  23 \rightarrow 222235523 \)

  • \(27601 = 7 \times 3943 \rightarrow 73943 \)

  • \(27602 = 2 \times 37 \times 373 \rightarrow 237373 \)
The run of eight numbers is listed below together with factorisations and home primes:

  • \(45162 = 2 \times 3^2 \times 13 \times 193 \rightarrow 23313193 \)

  • \(45163 = 19 \times 2377 \rightarrow 192377 \)

  • \(45164 = 2^2 \times 7 \times 1613 \rightarrow 2271613 \)

  • \(45165 = 3 \times 5 \times 3011\rightarrow 353011 \)

  • \(45166 = 2 \times 11 \times 2053 \rightarrow 2112053 \)

  • \(45167 = 31^2 \times 47 \rightarrow 313147\)

  • \(45168 = 2^4 \times 3 \times 941 \rightarrow 22223941 \)

  • \(45169 = 17 \times 2657 \rightarrow 172657 \)
All concatenations are applied to the prime factors in order from lowest to highest. Of course, runs formed by numbers that are concatenations of prime factors from highest to lowest are impossible because every second number is even with a smallest factor of 2. Every second concatenated number will thus be even as well.

Monday, 15 May 2023

Base-2 Harshad Numbers

I've written explicitly about Harshad numbers in two previous posts: Harshad Numbers on Saturday, 11 February 2017 and Harshad Numbers Revisited on Saturday, 30 June 2018. However, I've only mentioned Base-\(n\) Harshad numbers in passing and so this post will be about them, although the focus will be on the value of \(n=2\).

I was reminded of them because the number associated with my diurnal age today, 27070, has a property that affords it membership in OEIS A330932. Let's remember that Niven numbers are another name for Harshad numbers.


  A330932

Starts of runs of 3 consecutive Niven numbers in base 2 (A049445).          


What characterises a Harshad or Niven number is that it's divisible by the sum of its digits. For example, 12 has a sum of digits of 3 and 3 divides evenly into 12. Hence 12 is a Harshad number in base 10 but what about in base 2? The binary representation of 12 is 1100 and its sum of digits is then 2 which also divides 12 and thus 12 is also a Harshad number in base 2. 

As it turns out, 12 is a Harshad number in all bases but octal where it is represented as 14. The sum of digits, 5, does not divide into 12. There are only four all-harshad numbers and they are 1, 2, 4, and 6. However, let's get back to  27070, 27071 and 27072 and check that they are indeed Harshad numbers:$$\begin{align} 27070 &= 110100110111110_2\\ \text{sum of digits }&=10\\ \frac{27070}{10} &= 2707 \\ \\27071 &= 110100110111111_2\\ \text{sum of digits }&=11\\ \frac{27071 }{11}&=2461 \\ \\ 27072 &= 110100111000000_2\\ \text{sum of digits } &= 6\\ \frac{27072}{6} &= 4512 \end{align}$$So sure enough, 27070 does begin a run of three Harshad numbers in base 2. The other members of the sequence, up to 40000, are (permalink): 623, 846, 2358, 4206, 4878, 6127, 6222, 6223, 12438, 16974, 21006, 27070, 31295, 33102, 33103, 35343, 37134, 37630, 37638.

To quote from Wikipedia:
Cooper and Kennedy proved in 1993 that no 21 consecutive integers are all harshad numbers in base 10. They also constructed infinitely many 20-tuples of consecutive integers that are all 10-harshad numbers, the smallest of which exceeds \(10^{44363342786} \).

H. G. Grundman (1994) extended the Cooper and Kennedy result to show that there are \(2b\) but not \(2b + 1\) consecutive \(b\)-harshad numbers for any base \(b\). This result was strengthened to show that there are infinitely many runs of \(2b\) consecutive b-harshad numbers for \(b = 2\) or \(3\) by T. Cai (1996) and for arbitrary b by Brad Wilson in 1997.

In binary, there are thus infinitely many runs of four consecutive Harshad numbers and in ternary infinitely many runs of six.

Runs of four consecutive base-2 Harshad numbers occur for very large numbers. I checked and there were none in the range up to one million and, I suspect, far beyond this.

Thursday, 11 July 2019

Sphenic Brick Trajectories

I've made mention of sphenic numbers in three earlier posts. Specifically:
I've long championed the association between the surface area of a sphenic brick and its volume. Consider a sphenic number such as 170 that factors to 2 * 5 * 17. It can be considered to represent a rectangular prism with volume 170 cubic units and dimensions of 2, 5 and 7 units. The surface area of such a prism is 258 square units. In previous posts, I've examined the ratio of surface area to volume but today a thought struck me. What if the surface area itself in a sphenic number? This would mean that the surface area could be linked to another rectangular prism.

This is indeed the case for 170 because its surface area of 258 = 2 * 3 * 43 and can thus be linked to a prism with volume of 258 cubic units and dimensions of 2, 3 and 43 units. This prism has a surface area of 442 square units. The obvious question is: can this process be continued? Well 442 = 2 * 13 * 17 and so the answer is yes. The resulting prism has a surface area of 562 square units but 562 = 2 * 281 and so this is where things stopped.

I then got to thinking about the maximum number of iterations possible up to a certain limit. To investigate this, I needed to develop a robust algorithm and I spent most of the day tinkering with one. In the end, using SageMathCell, I succeeded. Here's a permalink to the coding window and below are the runs of eight iterations up to 40,000:

  • [7386, 12322, 12970, 18178, 19018, 20194, 22042, 22882, 25642]
  • [8078, 10414, 11086, 12142, 14062, 14734, 15502, 16942, 17902]
  • [9514, 10066, 12970, 18178, 19018, 20194, 22042, 22882, 25642]
  • [9515, 5646, 9422, 12142, 14062, 14734, 15502, 16942, 17902]
  • [9562, 12322, 12970, 18178, 19018, 20194, 22042, 22882, 25642]
  • [10634, 12322, 12970, 18178, 19018, 20194, 22042, 22882, 25642]
  • [15085, 10414, 11086, 12142, 14062, 14734, 15502, 16942, 17902]
  • [15110, 21174, 35302, 39094, 46246, 51190, 71686, 73942, 87430]
  • [15654, 26102, 27910, 39094, 46246, 51190, 71686, 73942, 87430]
  • [23313, 18110, 25374, 42302, 48862, 57790, 80926, 84862, 86590]
  • [27363, 26102, 27910, 39094, 46246, 51190, 71686, 73942, 87430]
  • [28217, 10414, 11086, 12142, 14062, 14734, 15502, 16942, 17902]
  • [30173, 10414, 11086, 12142, 14062, 14734, 15502, 16942, 17902]
  • [30441, 21566, 22782, 37982, 48862, 57790, 80926, 84862, 86590]
  • [32331, 26606, 27822, 46382, 59662, 64942, 71854, 75886, 83950]
  • [35121, 26606, 27822, 46382, 59662, 64942, 71854, 75886, 83950]

So starting with 7386, there is then a run of eight sphenic numbers generated by the volume-area iteration. The run ends at 25642 which is not a sphenic number. Similarly for the other chains shown and it should be noted that several chains merge into others. For example, 7386, 9514 and 9562, all end with 25642. 
So, how many iterations are possible? Well, up to \( \textbf{ten million}\), there are three chains of 15 iterations, all ending in \( \textbf{10186102} \) (permalink):
  • 8710117, 1384374, 2307302, 2394582, 3990982, 4009942, 4044454, 4470262, 4758790, 6662326, 7873702, 8021302, 8362822, 9649462, 9733222, 10186102 The factorisations are:
      number     factor
    
      8710117    13 * 613 * 1093
      1384374    2 * 3 * 230729
      2307302    2 * 53 * 21767
      2394582    2 * 3 * 399097
      3990982    2 * 467 * 4273
      4009942    2 * 239 * 8389
      4044454    2 * 19 * 106433
      4470262    2 * 31 * 72101
      4758790    2 * 5 * 475879
      6662326    2 * 11 * 302833
      7873702    2 * 107 * 36793
      8021302    2 * 47 * 85333
      8362822    2 * 13 * 321647
      9649462    2 * 233 * 20707
      9733222    2 * 43 * 113177
      10186102   2 * 23 * 79 * 2803
    
    
  • 9469213, 1768854, 2948102, 2958742, 3118822, 4009942, 4044454, 4470262, 4758790, 6662326, 7873702, 8021302, 8362822, 9649462, 9733222, 10186102 The factorisations are:
    number     factor
    
      9469213    13 * 61 * 11941
      1768854    2 * 3 * 294809
      2948102    2 * 787 * 1873
      2958742    2 * 37 * 39983
      3118822    2 * 7 * 222773
      4009942    2 * 239 * 8389
      4044454    2 * 19 * 106433
      4470262    2 * 31 * 72101
      4758790    2 * 5 * 475879
      6662326    2 * 11 * 302833
      7873702    2 * 107 * 36793
      8021302    2 * 47 * 85333
      8362822    2 * 13 * 321647
      9649462    2 * 233 * 20707
      9733222    2 * 43 * 113177
      10186102   2 * 23 * 79 * 2803
    
    
  • 9749077, 1768854, 2948102, 2958742, 3118822, 4009942, 4044454, 4470262, 4758790, 6662326, 7873702, 8021302, 8362822, 9649462, 9733222, 10186102 The factorisations are:
      number     factor
    
      9749077    13 * 73 * 10273
      1768854    2 * 3 * 294809
      2948102    2 * 787 * 1873
      2958742    2 * 37 * 39983
      3118822    2 * 7 * 222773
      4009942    2 * 239 * 8389
      4044454    2 * 19 * 106433
      4470262    2 * 31 * 72101
      4758790    2 * 5 * 475879
      6662326    2 * 11 * 302833
      7873702    2 * 107 * 36793
      8021302    2 * 47 * 85333
      8362822    2 * 13 * 321647
      9649462    2 * 233 * 20707
      9733222    2 * 43 * 113177
      10186102   2 * 23 * 79 * 2803