Showing posts with label density. Show all posts
Showing posts with label density. Show all posts

Saturday, 30 May 2026

Some Categories of Primes

There is a category of prime numbers with the property that when both the sum of their digits and the product of their digits is added to the number then the new, resultant numbers are also prime. An example would be 28181 with a sum of digits of 20 and a product of digits of 128 where:$$ \begin{align} 28181 + 20 &= 28201 \text{ prime} \\ 28181 + 128 &= 28309 \text{ prime} \end{align}$$In the range up to 40000, these primes have a density of 7.376% compared to all primes. Here is a list of such primes between 28000 and 40000 (permalink):

28097, 28181, 28703, 28901, 29153, 29179, 29209, 30089, 30119, 30203, 30313, 30449, 30469, 30539, 30557, 30649, 30661, 30713, 30803, 30809, 30829, 31019, 31307, 32063, 32069, 32083, 32173, 32203, 32401, 32687, 32957, 32971, 33013, 33037, 33091, 33301, 33413, 33547, 33581, 33587, 33769, 33851, 34313, 34667, 35053, 35059, 35251, 35257, 35323, 35507, 35509, 35521, 35569, 35831, 36209, 36229, 36469, 36559, 36607, 36919, 37019, 37039, 37097, 37321, 37369, 37501, 37507, 37547, 37871, 38047, 38351, 38959, 39019, 39079, 39103, 39161, 39301, 39521

These primes constitute OEIS A128717:


A128717: primes that yield another prime if one adds either the sum of its digits or the product of its digits.


Another category of prime involves its cube being pandigital, meaning that each digit from 0 to 9 occurs at least once with duplicates being permitted. Again 28181 satisfies this condition:$$28181^3 = 20753798525641$$Primes of this sort constitute:


A124629: primes \(p\) such that their cubes are pandigital.


The members of this sequence up to 40000 have a density is 1.523 % compared to all primes and these are (permalink):

5437, 6221, 7219, 8443, 10903, 11353, 15937, 17123, 18229, 19429, 20353, 20903, 20929, 21803, 21841, 21961, 22123, 22283, 22993, 23053, 23369, 23663, 24733, 25183, 25219, 25463, 26317, 26387, 26449, 27127, 27481, 28181, 28631, 28711, 28961, 29059, 29443, 29501, 30169, 31153, 31183, 32213, 32801, 33739, 33797, 33811, 33941, 34283, 35027, 35051, 35729, 35963, 36137, 36251, 36383, 36809, 36943, 37223, 37369, 37511, 37619, 37967, 38281, 38917

Another category of prime involves the average of the prime and the next prime being palindromic. Again 28181 satisfies since:$$ \frac{28181+28183}{2}=28182$$Many such primes are the lesser of a twin prime pair but not all. Primes of this sort constitute OEIS A242387:


A242387: lesser of consecutive primes whose average is a palindromic number.


The members of this sequence up to 40000 have a density of 1.213% compared to all primes and these are (permalink):

3, 5, 7, 97, 109, 281, 359, 389, 409, 509, 631, 653, 691, 743, 827, 857, 907, 937, 967, 1549, 2111, 2767, 4219, 4441, 7001, 9007, 9337, 9661, 10099, 11503, 12919, 13421, 16759, 17569, 21011, 21611, 23831, 26261, 26861, 28181, 29287, 29483, 30497, 31307, 32213, 33029, 33629, 34739, 36353, 37463, 39089

Another category of prime involves the differences between consecutive digits. Some primes have consecutive digits that differ by 6 or 7. An example is 28181 where we see that:$$ 2_{ \, 6} \, 8_{ \, 7} \, 1_{ \, 7} \, 8_{ \, 7} \, 1$$Such primes are few and far between and in the range up 40000, there are only the following:

17, 29, 71, 181, 281, 293, 607, 829, 929, 2939, 3929, 8171, 8293, 9281, 9293, 18181, 28181, 39293

Such primes belong to OEIS A048418:


A048418: primes whose consecutive digits differ by 6 or 7.


Yes another category involves totals of composite numbers between successive primes that are palindromes. 28181 qualifies once again because the next prime is its twin 28183 and the interprime number, 28182, is palindromic. Let's consider another prime, 29587. The next prime is 29599 and the composite numbers between them total 325523, a palindrome. Therefore we include 29587. These primes form OEIS A054266 with a density of only 0.8089% of the primes in the range up to 40000:


A054266: sum of composite numbers between prime \(p\) and nextprime(\(p\)) is palindromic.


The members up to 40000 are (permalink):

2, 3, 5, 109, 193, 281, 509, 661, 827, 857, 1439, 2111, 3433, 3889, 3967, 4549, 6661, 7001, 8467, 10099, 17203, 18583, 21011, 21611, 23831, 24847, 25117, 26261, 26497, 26861, 28181, 29587, 30497, 31307

We see that 28181, my diurnal age today, features in all these different categories of primes. Another category of primes (to which 28181 cannot belong) is to consider primes that only consist of non-prime digits (0, 1, 4, 6, 8 and 9). They do not contain any prime digits (2, 3, 5 or 7). Such primes belong to OEIS A034844 and comprise 5.782% of the primes up to 40000:


A034844: primes with only nonprime decimal digits.


Here are the primes up to 40000 (permalink):

11, 19, 41, 61, 89, 101, 109, 149, 181, 191, 199, 401, 409, 419, 449, 461, 491, 499, 601, 619, 641, 661, 691, 809, 811, 881, 911, 919, 941, 991, 1009, 1019, 1049, 1061, 1069, 1091, 1109, 1181, 1409, 1481, 1489, 1499, 1601, 1609, 1619, 1669, 1699, 1801, 1811, 1861, 1889, 1901, 1949, 1999, 4001, 4019, 4049, 4091, 4099, 4111, 4409, 4441, 4481, 4649, 4691, 4801, 4861, 4889, 4909, 4919, 4969, 4999, 6011, 6089, 6091, 6101, 6199, 6449, 6469, 6481, 6491, 6619, 6661, 6689, 6691, 6841, 6869, 6899, 6911, 6949, 6961, 6991, 8009, 8011, 8069, 8081, 8089, 8101, 8111, 8161, 8191, 8419, 8461, 8609, 8641, 8669, 8681, 8689, 8699, 8819, 8849, 8861, 8941, 8969, 8999, 9001, 9011, 9041, 9049, 9091, 9109, 9161, 9181, 9199, 9419, 9461, 9491, 9601, 9619, 9649, 9661, 9689, 9811, 9901, 9941, 9949, 10009, 10061, 10069, 10091, 10099, 10111, 10141, 10169, 10181, 10499, 10601, 10691, 10861, 10889, 10891, 10909, 10949, 11069, 11119, 11149, 11161, 11411, 11489, 11491, 11681, 11689, 11699, 11801, 11909, 11941, 11969, 11981, 14009, 14011, 14081, 14149, 14401, 14411, 14419, 14449, 14461, 14489, 14669, 14699, 14869, 14891, 14969, 16001, 16061, 16069, 16091, 16111, 16141, 16189, 16411, 16481, 16619, 16649, 16661, 16691, 16699, 16811, 16889, 16901, 16981, 18041, 18049, 18061, 18089, 18119, 18149, 18169, 18181, 18191, 18199, 18401, 18461, 18481, 18661, 18691, 18869, 18899, 18911, 18919, 19001, 19009, 19069, 19081, 19141, 19181, 19441, 19469, 19489, 19609, 19661, 19681, 19699, 19801, 19819, 19841, 19861, 19889, 19891, 19919, 19949, 19961, 19991

Primes beginning with 2 or 3 cannot qualify and so it is only when we reach primes beginning with 4 that membership is possible. The first of these is 40009.

We can flip this and consider only those primes that are comprised of prime digits. These form OEIS A019546:


A019546: primes whose digits are primes; primes having only {2, 3, 5, 7} as digits.


These primes have a density of 2.890% of the primes up to 40000 are they are (permalink):

2, 3, 5, 7, 23, 37, 53, 73, 223, 227, 233, 257, 277, 337, 353, 373, 523, 557, 577, 727, 733, 757, 773, 2237, 2273, 2333, 2357, 2377, 2557, 2753, 2777, 3253, 3257, 3323, 3373, 3527, 3533, 3557, 3727, 3733, 5227, 5233, 5237, 5273, 5323, 5333, 5527, 5557, 5573, 5737, 7237, 7253, 7333, 7523, 7537, 7573, 7577, 7723, 7727, 7753, 7757, 22273, 22277, 22573, 22727, 22777, 23227, 23327, 23333, 23357, 23537, 23557, 23753, 23773, 25237, 25253, 25357, 25373, 25523, 25537, 25577, 25733, 27253, 27277, 27337, 27527, 27733, 27737, 27773, 32233, 32237, 32257, 32323, 32327, 32353, 32377, 32533, 32537, 32573, 33223, 33353, 33377, 33533, 33577, 33757, 33773, 35227, 35257, 35323, 35327, 35353, 35527, 35533, 35537, 35573, 35753, 37223, 37253, 37273, 37277, 37337, 37357, 37537, 37573

Tuesday, 24 February 2026

Visualising a Difference of Two Cubes

For some time I've thought about a visual representation of a positive integer that is the difference of two cubes. For example, the number 973 can be represented thus:$$ \begin{align} 973 &= 1000 - 27 \\ &=10^3-3^3 \end{align} $$Given the limitations of Nano Bananas, I thought that a rought sketch of how I wanted to represent the number would help. This is shown in Figure 1.


Figure 1

I uploaded this sketch to Gemini along with the following prompt:

Use the uploaded image to create a realistic depiction of the cube shown following the heavy lines that drift the edges. The large cube has a smaller cube removed from it. The cube sits on a flat surface and is golden coloured with soft lighting highlighting the missing section of the cube. Maintain two point perspective and incorporate the numerals shown.
Figure 2 shows the result:


Figure 2
I asked Gemini:

Given today's gold price what would a cube of 100% pure gold with side of 10 millimetres be worth in US dollars. Also price a cube of gold with side of 3 millimetres.
The response:

To calculate the value of both cubes, we need today's gold price and the physical density of pure gold.

As of February 24, 2026, the spot price for 24k (100% pure) gold is approximately 166.69 USD per gram. The density of pure gold is 19.32 grams per cubic centimeter (g/cm³).

1. The 10 mm Cube

Volume: 10 mm × 10 mm × 10 mm = 1,000 mm³, which is exactly 1 cm³.

Mass: 1 cm³ × 19.32 g/cm³ = 19.32 grams.

Value: 19.32 grams × 166.69 USD/gram = 3,220.45 USD.

2. The 3 mm Cube

Volume: 3 mm × 3 mm × 3 mm = 27 mm³, which is 0.027 cm³.

Mass: 0.027 cm³ × 19.32 g/cm³ = 0.52164 grams.

Value: 0.52164 grams × 166.69 USD/gram = 86.95 USD.

Connecting this back to the golden object depicted in your image—a 10 mm cube with a 3 mm cubed corner removed—its total gold value today would be 3,220.45 USD minus 86.95 USD, which equals 3,133.50 USD.

There are 824 numbers up to 40000 that are the difference of two cubes (some in more ways than one) but only those from 28000 to 40000 are listed below (permalink will generate the full list):

28063, 28415, 28460, 28519, 28568, 28656, 28672, 28701, 28737, 28791, 28828, 28854, 29051, 29062, 29078, 29080, 29107, 29279, 29393, 29402, 29448, 29528, 29575, 29617, 29666, 29701, 29727, 29735, 29763, 29764, 29783, 29790, 30016, 30024, 30043, 30105, 30248, 30301, 30312, 30483, 30571, 30708, 30807, 30907, 30970, 31024, 31031, 31040, 31085, 31106, 31213, 31228, 31232, 31304, 31437, 31519, 31768, 31806, 31841, 31869, 31976, 32039, 32137, 32227, 32256, 32319, 32425, 32445, 32464, 32465, 32552, 32562, 32643, 32704, 32741, 32760, 32761, 32767, 32832, 32851, 32858, 32920, 32949, 32984, 33077, 33193, 33336, 33391, 33472, 33614, 33724, 33740, 33752, 33875, 34027, 34047, 34209, 34391, 34489, 34531, 34606, 34658, 34669, 34784, 34875, 34902, 34930, 34937, 35008, 35028, 35163, 35189, 35208, 35315, 35317, 35425, 35576, 35594, 35721, 35812, 35873, 35910, 35929, 35936, 35971, 36008, 36016, 36153, 36253, 36297, 36316, 36504, 36506, 36560, 36631, 36632, 36785, 36829, 37000, 37043, 37107, 37296, 37297, 37367, 37395, 37448, 37449, 37576, 37648, 37962, 37969, 37973, 38017, 38142, 38151, 38285, 38304, 38402, 38486, 38528, 38575, 38619, 38647, 38656, 38779, 38792, 38961, 39004, 39088, 39130, 39179, 39240, 39247, 39277, 39296, 39303, 39331, 39368, 39500, 39611, 39636, 39797, 39807, 39815, 39816, 39823

Notice how there is clustering about cubic numbers. For example, \(31^3=32768\) and so the following are members of the sequence:

  • \(31^3-1^3=32767\)
  • \(31^3-2^3=32760\)
  • \(31^3-3^3=32741\)
  • \(31^3-4^3=32704\)
However, looking back at the range of numbers above, notice how 32761 slips in (to form a consecutive pair with 32760) and this is because:$$32761=105^3-104^3$$This number is also mentioned below. These numbers that are differences of two cubes form OEIS A181123. The OEIS comments are interesting:

Because \(x^3-y^3 = (x-y)(x^2+xy+y^2)\), the difference of two cubes is a prime number only if \(x=y+1\), in which case all the primes are cuban, see A002407.

The difference can be a square (see A038597), but Fermat's Last Theorem prevents the difference from ever being a cube.

The numbers that are square and the difference of two cubes are 169, 784, 2401, 10816, 21609, 32761 and 35721 with squares as shown:$$ \begin{align} 169 &=13^2 =8^3-7^3\\ 784 &= 28^2 =10^3-6^3\\ 2401 &=49^2=14^3-7^3 \\ 10816 &=104^2=32^3-28^3 \\ 21609 &= 147^2=28^3-7^3 \\32761 &=181^2 =105^3-104^3 \\35761 &= 189^2=33^3-6^3 \end{align}$$There are 44 cuban primes in the range and they are:

7, 19, 37, 61, 127, 271, 331, 397, 547, 631, 919, 1657, 1801, 1951, 2269, 2437, 2791, 3169, 3571, 4219, 4447, 5167, 5419, 6211, 7057, 7351, 8269, 9241, 10267, 11719, 12097, 13267, 13669, 16651, 19441, 19927, 22447, 23497, 24571, 25117, 26227, 27361, 33391, 35317

With all these cuban primes, the difference between the bases of the primes must be 1 e.g. \(7=2^3-1^3\).

In conclusion, the main point of this post was to show one way in which a difference of two cubes can be represented physically. While Mathematics is highly abstract, it's still possible on occasion to make it more concrete.

Saturday, 8 March 2025

Density of Primes

It's well known that the density of primes decreases as we proceed along the number line but, in the range of numbers up to 100,000, where can we find intervals where the density of primes is quite high. To quantify this density, let's take a prime and consider the next FIVE primes that follow it. Now let's calculate the difference between this sixth prime and the first and call this difference the "gap". Thus we have primes 1 to 6 and the gap is given by:$$\textbf{gap = prime 6 - prime 1}$$Where is this gap equal to 14 (which is minimum possible)? We'll identify the position by reference to the first prime and the gap will tell us the sixth prime because:$$\textbf{prime 6 = prime 1 + gap} $$And so we have the following gap statistics:$$ \textbf{gaps of 14 occur at }\\ 3, 5$$ $$\textbf{gaps of 16 occur at }\\7, 97, 16057, 19417, 43777$$ $$ \textbf{gaps of 18 occur at} \\11, 13, 29, 223, 1289,\\ 1481, 1861, 4783,5639, 5641, 13679,\\ 27733, 44263, 80669, 88799, 88801, 93479$$ $$\textbf{gaps of 20 occur at}\\17, 23, 41, 53, 59, 89, \\179, 263, 599, 641, 809, 1277, \\1283, 1601, 1607, 3449, 3527, 3911, \\4001, 4637, 5849, 9419, 14543, 18041, \\19421, 21011, 22271, 26681, 26711, 43781, \\45119,51419, 54401, 55331, 62969, 65699, \\71327, 75983, 87539, 88793, 97367, 97841 $$Figure 1 shows a plot of the various primes (up to 100,000) and their associated gaps. The largest gap of 154 occurs at 69499 and thus the interval is from 69499 to 69653.


Figure 1: permalink

What I've considered is just one measure of prime density. The decision to consider the gap between six successive primes is quite arbitrary. I could have considered five or seven.

Monday, 19 February 2024

Early Bird Versus Punctual Bird Numbers

I have to confess to not having heard of "early bird numbers" and "punctual bird numbers" before, even though they are quite plentiful. OEIS  A116700 explains the former:


 A116700

"Early bird" numbers: write the natural numbers in a string 12345678910111213.... Sequence gives numbers that occur in the string ahead of their natural place, sorted into increasing order.



As the OEIS comments explain:

"12" appears at the start of the string, ahead of its position after "11", so is a member. So are 123, 23, 1234, 234, 34, ... and sorting these into increasing order we get 12, 21, 23, 31, ...

The initial members of the sequence are (permalink):

12, 21, 23, 31, 32, 34, 41, 42, 43, 45, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65, 67, 71, 72, 73, 74, 75, 76, 78, 81, 82, 83, 84, 85, 86, 87, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 110, 111, 112, 121, 122, 123, 131, 132, 141, 142, 151, 152, 161, 162, 171 

There are 23214 such numbers in the range up to 40,000. However, there are 80630 in the range up to 100,000 and in fact these numbers have an asymptotic density of 1. There is a complementary sequence OEIS A131881 (permalink):


 A131881

Complement of A116700. Might be called "punctual birds".    



The initial members of the sequence are:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 25, 26, 27, 28, 29, 30, 33, 35, 36, 37, 38, 39, 40, 44, 46, 47, 48, 49, 50, 55, 57, 58, 59, 60, 66, 68, 69, 70, 77, 79, 80, 88, 90, 100, 102, 103, 104, 105, 106, 107, 108, 109, 113, 114 

It can be seen that 12 is missing from the above list because it is the first member of OEIS  A116700. These numbers have an asymptotic density of zero. It's interesting to explore runs of consecutive numbers. For example, returning the early bird numbers, the record runs of consecutive numbers are as follows (starting number on left and length of run on the right):
  • 12 --> 1
  • 31 --> 2
  • 41  -->3
  • 51  -->4
  • 61  --> 5
  • 71  --> 6
  • 81  --> 7
  • 91  --> 9
  • 210  --> 14
  • 310  --> 25
  • 410  --> 36
  • 510  --> 47
  • 610  --> 58
  • 710  --> 69
  • 810  --> 80
  • 901  --> 99
  • 2100  --> 124
  • 3100  --> 235
  • 4100  --> 346
  • 5100  --> 457
  • 6100  --> 568
  • 7100  --> 679
  • 8100  --> 790
  • 9091  --> 909