Showing posts with label index. Show all posts
Showing posts with label index. Show all posts

Monday, 27 July 2026

Finding Numbers Within The Copeland-Erdos Constant

I watched this video recently about the Copeland-Erdos constant.

There following text was included below the video:

Write the primes in a row — 2, 3, 5, 7, 11, 13, and on forever — put a decimal point in front, and you get a single number: 0.235711131719232931… the Copeland–Erdős constant. In 1946, Copeland and Erdős proved it is normal in base ten: every finite string of digits appears in its expansion, and appears exactly as often as pure chance would predict — each digit one tenth of the time, each pair one hundredth, every block its fair share. So the opening of pi (314159) is in there, at digit 6,903. So is 42, at digit 214. So is every birthday, phone number, and message ever written.

What makes this remarkable: normality is the rule, not the exception — a randomly chosen real number is normal with probability one (Borel, 1909) — yet we still cannot prove that pi, e, or the square root of two are normal. The first explicit example was Champernowne's constant (0.123456789101112…), normal because it was built by pasting in every integer on purpose. The primes do no such favor: they thin out, follow no pattern, and were never designed to be tidy — and their concatenation is normal anyway. This video builds the number, defines normality, shows why the famous constants resist proof, and walks the intuition (via the prime number theorem) for why the patternless primes still even out in the limit.

I was interested in determining if and where a particular number, let's say my diurnal age today, might occur within this constant. Gemini created a program to do this, although I've written similar programs in the past myself for finding numbers within other constants like \( \pi\), \(e\) and \( \sqrt{2}\). Here is a permalink for the Gemini program. I've incorporated this program into my daily number analysis. Here is the output for the number associated with my diurnal age today: 28239.

The position in the Copeland-Erdos constant

Target '28239' first appears at position: 61014

What's of interest is whether a number can be equal to its index. I got Gemini to investigate and here is what it came up with:

While no fixed point where the 1-based index $P(N)$ equals $N$ itself has been found among smaller integers in the Copeland–Erdős constant, number-theoretic density principles dictate that such numbers must exist among larger composite numbers, even though they are mathematically impossible among prime numbers.

To see why this dichotomy exists, we have to look at the growth rate of the string indices for primes versus composite numbers.

Why Primes Never Equal Their Index

For any prime number $p$, its "natural" appearance occurs when $p$ itself is concatenated into the decimal stream. The 1-based index where $p$ begins is equal to $1$ plus the total number of digits of all primes strictly smaller than $p$:

$$P_{\text{natural}}(p) = 1 + \sum_{q < p} \lfloor \log_{10}(q) + 1 \rfloor$$

Using Chebyshev's function $\theta(p) = \sum_{q \le p} \ln(q)$, which by the Prime Number Theorem is asymptotically equivalent to $p$, we can evaluate the sum of the base-10 logarithms of all primes up to $p$:

$$\sum_{q < p} \log_{10}(q) = \frac{1}{\ln 10} \sum_{q < p} \ln(q) \sim \frac{p}{\ln 10} \approx 0.4343 \times p$$

Because $\frac{1}{\ln 10} \approx 0.4343 < 1$, the cumulative number of digits written into the stream grows at less than half the rate of the prime numbers themselves. By the time we concatenate a large prime $p$, its starting position is only around the $0.4343p$ mark. If $p$ happens to appear even earlier as an accidental substring across prime boundaries, its index is smaller still.

Therefore, for all primes, $P(p)$ is strictly less than $p$, making a fixed point $P(p) = p$ impossible.

Why Composites Can Form Fixed Points

Composite numbers behave completely differently because they never get a "natural" turn in the prime concatenation. They can only appear in two ways:

  1. As an accidental boundary string formed across the junction of two or more adjacent primes (for example, 4 first appears at index 21, spanning across the end of $3\mathbf{7}$ and the start of $\mathbf{4}1$).
  2. As a substring entirely within a much larger prime $q > N$.

Because the Copeland–Erdős constant is normal in base 10 (proven by Copeland and Erdős in 1946), every finite decimal string is guaranteed to appear eventually. However, the expected waiting time to see a specific $k$-digit composite string by chance in a normal sequence is roughly $10^k \ln 10 \approx 2.3 \times 10^k$.

Because $N$ itself sits between $10^{k-1}$ and $10^k$, a typical composite number that does not get an early boundary match will appear at an index much larger than $N$.

The Oscillation of $P(N) - N$

We can see this sharp split by examining the first few integers in the constant (OEIS A229190):

Integer $N$ Index $P(N)$ Type Behavior
2 1 Prime $P(N) < N$
3 2 Prime $P(N) < N$
4 21 Composite $P(N) > N$
5 3 Prime $P(N) < N$
6 31 Composite $P(N) > N$
7 4 Prime $P(N) < N$
8 41 Composite $P(N) > N$
9 12 Composite $P(N) > N$
10 47 Composite $P(N) > N$

Notice how consistently the primes lag behind their own values ($P(N) < N$), while the composite numbers overshoot ($P(N) > N$).

As we examine larger numbers, "lucky" composite numbers will occasionally appear unusually early due to boundary concatenations, while "unlucky" ones will appear late. Because the difference function $f(N) = P(N) - N$ oscillates wildly between negative values (for primes and early-matching composites) and large positive values (for late-matching composites), the graph of $P(N)$ repeatedly jumps across the line $Y = N$.

While finding a specific integer where $P(N) = N$ requires extensive string-searching through millions of digits, this continuous crossing confirms that fixed points exist among composite numbers.

Monday, 6 July 2026

Recurring Digital Invariant Variant (RDIV) Algorithm

Let's consider the following algorithm (formally called the Recurring Digital Invariant Variant or RDIV algorithm - see this link for an explanation of the name):

  • choose a number \(n\)
  • let \(k\) be the number of digits in \(n\)
  • raise each digit of \(n\) to the \(k\)-th power and add the results
  • call the new number \(n\) and repeat
Let's use \(n=14\) as an example:

  • \(14 \rightarrow 1^2 + 4^2 = 17\)
  • \(17 \rightarrow 1^2 + 7^2 = 50\)
  • \(50 \rightarrow 5^2 + 0^2 = 25\)
  • \(25 \rightarrow 2^2 + 5^2 = 29\)
  • \(29 \rightarrow 2^2 + 9^2 = 85\)
  • \(85 \rightarrow 8^2 + 5^2 = 89\)
  • \(89 \rightarrow 8^2 + 9^2 = 145\)
  • \(145 \rightarrow 1^3 + 4^3 + 5^3 = 190\)
  • \(190 \rightarrow 1^3 + 9^3 + 0^3 = 730\)
  • \(730 \rightarrow 7^3 + 3^3 + 0^3 = 370\)
  • \(370 \rightarrow 3^3 + 7^3 + 0^3 = 370\) 
370 is a narcissistic number as explained in my post Narcissistic, D-Powerfull and Friedman Numbers. The trajectory of any number under this algorithm will either end with a narcissistic number (as was the case with 14) or it will enter a loop (as is the case with 28218). The latter has the following trajectory (permalink):

==================================================
RDIV TRAJECTORY ANALYSIS FOR INPUT: 28218
==================================================
Full Trajectory Visited:

28218, 65601, 18678, 90120, 59082, 94974, 136953, 595181, 824837, 646826, 406272, 168529, 855931, 825565, 355739, 681798, 1220035, 80569, 102718, 379859, 1459029, 9660576, 6524445, 485466, 379273, 768261, 473170, 240124, 8321, 4194, 7074, 5058, 5346, 2258, 4753, 3363, 1539, 7268, 7809, 13058, 36137, 25070, 19964, 126899, 1371747, 2489202, 6896889, 16417266, 10869443, 61641187, 25966788, 86116067, 27580867, 47154531, 6683686, 5316235, 440689, 848433, 533938, 811397, 911965, 1125165, 436317, 169860, 886898, 1626673, 1665667, 2021413, 18829, 124618, 312962, 578955, 958109, 1340652, 376761, 329340, 537059, 681069 -> [loops back to 886898]

Loop Entry Point:   886898 (encountered at step 65)

Pre-period Length:  64 step(s) before entering cycle

Cycle Length:       14 distinct number(s) in the loop

Canonical Cycle:    18829, 124618, 312962, 578955, 958109, 1340652, 376761, 329340, 537059, 681069, 886898, 1626673, 1665667, 2021413

==================================================

Figure 1 shows a graph of its trajectory:

Figure 1: permalink

I've incorporated this algorithm into my daily number analysis.

Friday, 13 March 2026

Prime Indexed Primes

It struck me today that the indexing of primes is base-independent. It's obvious I know but for some reason I'd maintained this vague notion that the indexing was base-dependent. Today I turned 28103 days old and this number is the product of the 37th prime (157) and the 41st prime (179).

28103 is a member of OEIS A119658:


 A119658: area of consecutive prime-indexed prime rectangles or the product of consecutive prime-indexed primes.

The initial sequence members are:

15, 55, 187, 527, 1271, 2419, 3953, 5561, 9047, 13843, 19939, 28103, 34189, 40301, 50851, 66757, 78391, 93673, 116843, 129551, 147167, 172831, 198691, 234649, 278423, 307961, 330481, 351613, 369583, 437453, 523951, 571247, 616081, 684623, ...

As can be seen, the sequence members get large rather quickly. There are 575 prime-indexed primes in the range up to 40000 and they can be combined in various ways to generate new sequences such as OEIS A119658. Another example involving the sum instead of the product is OEIS A299644:

 
 A299644: a(\(n\)) = prime(prime(\(n+1\))) + prime(prime(\(n\))).

The initial sequence members are:

8, 16, 28, 48, 72, 100, 126, 150, 192, 236, 284, 336, 370, 402, 452, 518, 560, 614, 684, 720, 768, 832, 892, 970, 1056, 1110, 1150, 1186, 1216, 1326, 1448, 1512, 1570, 1656, 1736, 1796, 1886, 1958, 2022, 2094, 2150, 2240, 2324, 2372, 2418, 2514, 2706, 2842, 2880, 2918, ...

Another example is OEIS A318294 involving Sophie Germain primes:


 A318294: prime-indexed primes \(p\) such that \(2p + 1\) is also a prime-indexed prime.

The initial sequence members are:

5, 41, 1031, 3299, 3761, 6323, 7649, 7841, 10589, 12959, 18443, 37853, 38039, 44729, 58511, 59723, 60509, 77813, 105971, 134489, 137999, 190523, 194933, 200351, 239633, 250751, 266093, 288653, 315011, 366161, 376241, 377633, 393401, 410999, 420419, 420779, 450431, 474983

You can of course create sequences of your own that aren't in the OEIS database. For example, though the sum of two prime-indexed primes is always a composite number, what if we add 1 and ask whether the result is also a prime-indexed prime. The result is the following sequence which has 12 members below 40000:

17, 127, 1217, 3761, 4091, 5701, 8287, 10663, 21149, 35023, 37061, 39733

The first member is \(17_{\small{7} }= 5_{\small{3 }}+ 11_{\small{5 }}+ 1\) where the subscripts denote the prime index.

Friday, 24 January 2025

A Challenging Sequence

Here is a sequence that appeared in a 1926 SAT examination where participants had about twenty seconds on average to solve each question: $$750, 21, 264, 183,210, \dots, \dots$$Given the first five members of the sequence, one must find the next two members. At first there seems to be no pattern at all but the key to the solution is to look at the differences between the members of the sequence. 

With this insight, the solution is straightforward. Let's look at the differences between successive terms:$$\begin{align} 21- 750 &=-729\\ 264 -21 &= 243\\183-264 &= -81\\210-183 &= 27 \end{align}$$This gives the sequence:$$-729, 243, -81, 27=-3^6, +3^5, -3^4,+3^3$$Clearly the remaining differences are -3^2 and +3 and the sequence is then as shown in Figure 1:


Figure 1

In sequence notation we could express the successive terms using this formula:$$a_{n+1}=a_n + (-1)^{n+1} \cdot 3^{6-n} \text{ with }a_0=750$$The terms of this sequence will approach a limit of 203.25 (permalink). 

It's easy to generate other sequences using this approach. For example:$$100, 104, 95, 120, 56, \dots, \dots $$Once again, we are given the first five members of the sequence and must find the next two. Let's look at the differences:$$ \begin{align} 104 - 100 &= 4\\95-104 &=-9\\120-95 &=25\\56-120 &=-64 \end{align}$$These differences are all squares so let's write the difference in base index notation. We get:$$2^2, -3^2, 5^2, -8^2$$The bases (2, 3, 5 and 8) are Fibonacci numbers and so the progression must be \(13^2\) and \(-21^2\). The sequence is thus:$$100, 104, 95, 120, 56, 225, -216$$The absolute value of the terms of this sequence will increase without bound, alternating between positive and negative values. The formula for this sequence is (permalink):$$a_{n+1}=a_n + (-1)^n \cdot (\text{fibonacci}(n+3))^2 \text{ with } a_0=100$$The general formula for these types of sequences is:$$a_{n+1}=a_n+ \text{f}(n)$$The approach to finding missing terms is to find what \(\text{f}(n)\) is:$$f(n)=a_{n+1}-a_n$$The form of this function should emerge when considering the initial differences between the terms:$$ \text{f}(0), \text{f}(1),\text{f}(2),\text{f}(3), \dots$$

Monday, 11 December 2023

Fibonacci Numbers in the Abundancy Index

I've made several posts over the years concerning numbers and their associated abundancy. The abundancy of a number \(n\) is defined as:$$ \frac{\sigma_1(n)}{n} $$The abundancy of a number is sometimes referred to as its abundancy index. The number associated with my diurnal age today, 27280, is a member of OEIS  A349687:


 A349687

Numbers whose numerator and denominator of their abundancy index are both Fibonacci numbers.


The initial members of the sequence are (permalink):

1, 2, 6, 15, 24, 26, 28, 84, 90, 96, 120, 270, 330, 496, 672, 1335, 1488, 1540, 1638, 8128, 24384, 27280, 44109, 68200, 131040, 447040, 523776, 18506880, 22256640, 33550336, 36197280, 38257095, 65688320, 91963648, 95472000, 100651008, 102136320, 176432256, 197308800

The initial Fibonacci numbers are as follows:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657

In the case of 27280 we have:$$ \begin{align} \frac{\sigma_1(27280)}{27280} &= \frac{71424}{27280}\\ &= \frac{144}{55} \end{align} $$We find that two earlier members of the OEIS sequence, 330 and 1540, have this same abundancy as do two later members, 68200 and 447040. I only checked up to one million so there will be many more numbers with the same abundancy as 27280. Numbers with the same abundancy are called friendly numbers. These number properties are base independent.

A variation on the above would be use the set of square numbers instead of the Fibonacci numbers. Up to 40,000, the square numbers are:

1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3025, 3136, 3249, 3364, 3481, 3600, 3721, 3844, 3969, 4096, 4225, 4356, 4489, 4624, 4761, 4900, 5041, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, 6400, 6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 7921, 8100, 8281, 8464, 8649, 8836, 9025, 9216, 9409, 9604, 9801, 10000, 10201, 10404, 10609, 10816, 11025, 11236, 11449, 11664, 11881, 12100, 12321, 12544, 12769, 12996, 13225, 13456, 13689, 13924, 14161, 14400, 14641, 14884, 15129, 15376, 15625, 15876, 16129, 16384, 16641, 16900, 17161, 17424, 17689, 17956, 18225, 18496, 18769, 19044, 19321, 19600, 19881, 20164, 20449, 20736, 21025, 21316, 21609, 21904, 22201, 22500, 22801, 23104, 23409, 23716, 24025, 24336, 24649, 24964, 25281, 25600, 25921, 26244, 26569, 26896, 27225, 27556, 27889, 28224, 28561, 28900, 29241, 29584, 29929, 30276, 30625, 30976, 31329, 31684, 32041, 32400, 32761, 33124, 33489, 33856, 34225, 34596, 34969, 35344, 35721, 36100, 36481, 36864, 37249, 37636, 38025, 38416, 38809, 39204, 39601, 40000

We find only 18 numbers qualify (permalink): 

1, 40, 81, 135, 216, 224, 400, 819, 1372, 3240, 3744, 4650, 6318, 18144, 21700, 27930, 30240, 32760

Here is the breakdown:

1 --> 1/1 = 1/1
40 --> 90/40 = 9/4
81 --> 121/81 = 121/81
135 --> 240/135 = 16/9
216 --> 600/216 = 25/9
224 --> 504/224 = 9/4
400 --> 961/400 = 961/400
819 --> 1456/819 = 16/9
1372 --> 2800/1372 = 100/49
3240 --> 10890/3240 = 121/36
3744 --> 11466/3744 = 49/16
4650 --> 11904/4650 = 64/25
6318 --> 15288/6318 = 196/81
18144 --> 60984/18144 = 121/36
21700 --> 55552/21700 = 64/25
27930 --> 82080/27930 = 144/49
30240 --> 120960/30240 = 4/1
32760 --> 131040/32760 = 4/1

These numbers belong to OEIS A069070.

Saturday, 12 March 2022

Third Order Odds and Evens Trajectory for Numbers 1 to 10.

My previous post was titled Second Order Odds and Evens Trajectory for Numbers 1 to 99 and in this post I will be looking at the behaviour of the numbers from 1 to 10 under the recursive rule:

number --> number + \( \sum d_o^3 - \sum d_e^3 \) 

where \( d_o^3 \) are the number's odd digits raised to the power \( 3\) and \( d_e^3 \) are the number's even digits raised to the power \( 3\).  There is more variability with the numbers when \(k=3\) so I'm restricting my analysis to just the numbers from 1 to 10. A full analysis from 1 to 99 would be too lengthy but this is the beginning of the third order analysis and I'll follow up with more numbers in a future post.

Figure 1 shows the trajectory for the number 1. The entire trajectory consists of 161 steps and begins with 1, 2, -6, 210, 203, 222, 198, ... . The numbers that are in the final loop are {-7721, -8400, -7824, -7583, -7566, -7602}. The minimum value reached is -8441.

Figure 1

Here we see how the power of 3 drives the trajectory into increasingly negative territory until there is a brief rally after which the loop is reached.
 
2 is on exactly the same trajectory as 1 since 1 --> 2 under the odds and evens rule.

3 has a brief trajectory of only 14 steps: 3, 30, 57, 525, 767, 1237, 1600, 1385, 1026, 803, 318, -166, 265, 166, -265, -166 and ends in the loop {-166, 265, 166, -265}. See Figure 2.

Figure 2

30 and 57 also lie on the path of 3 and thus end in the same {-166, 265, 166, -265} loop.

4 follows a similar pattern to 1 and 2 except that the maximum value is +8441 and the loop is the same except that the members are positive {7721, 8400, 7824, 7583, 7566, 7602}. See Figure 3.


Figure 3

5 and 6 and 7 have lengthy trajectories but eventually end up in the same positive loop as 4.

8 produces a new trajectory that plummets to a record low of -34870 and ends in the loop {-34203, -34185, -33762, -33935, -34870, -34664, -34131, -34123, -34106, -33854, -33457, -33915, -34824} after 169 steps. See Figure 4.


Figure 4

9 follows a similar trajectory to 1 and 2 ending in the negative loop {-7721, -8400, -7824, -7583, -7566, -7602}.

10 follows a similar trajectory to 4, 5, 6 and 7 ending in the positive loop {7721, 8400, 7824, 7583, 7566, 7602}. 

So in summary:

  • 1, 2 and 9 end in the loop {-7721, -8400, -7824, -7583, -7566, -7602}.
  • 3 ends in the loop {-166, 265, 166, -265}.
  • 4, 5, 6, 7 and 10 end in the loop {7721, 8400, 7824, 7583, 7566, 7602}. 
  • 8 ends in the loop {-34203, -34185, -33762, -33935, -34870, -34664, -34131, -34123, -34106, -33854, -33457, -33915, -34824}.

Thursday, 9 December 2021

Digit Sum Raised to Integer Powers

I'm familiar with what happens when the operation of sum of the digits squared is applied repeatedly to a number. Either the number 1 is reached or the loop {4, 16, 37, 58, 89, 145, 42, 20} is entered. Numbers that reach 1 are called happy numbers and I wrote about these in a blog post on June 26th 2018 titled Happy Numbers.

I hadn't considered what happens when the operation of digit sum squared is repeatedly applied. Let's highlight the difference between the two operations using my diurnal age of 26548 as an example.$$26548 \rightarrow 2^2+6^2+5^2+4^2+8^2=4+36+25+16+64=145\\26548 \rightarrow (2+6+5+4+8)^2=25^2=625$$In the case of the sum of the digits squared, it can be seen that continuing the operation leads to a loop because:$$145 \rightarrow 1^2+4^2+5^2=42$$However, in the case of the square of the digit sum, a loop is also entered because:$$625 \rightarrow (6+2+5)^2 = 169 \rightarrow (1+6+9)^2=256 \rightarrow (2+5+6)^2=169$$Nearly 45% of all numbers will enter this loop. Another 33% will end in 81. For example, 26547 follows this trajectory:$$26547 \rightarrow 576 \rightarrow 324 \rightarrow 81$$Another 22% will end in 1 and, in general, it seems that all numbers will either end in 1 or 81 or enter the loop {169, 256]. Here is a permalink to SageMathCell that will confirm this. The algorithm is easily modifiable to accommodate powers greater than 2 and so what happens if the digit sum is repeatedly raised to the third, fourth, fifth powers etc. can be investigated. Let's look next at the digit sum cubed.

What we find is that almost 32% of numbers enter the loop {6859, 21952}:$$6859 \rightarrow 28^3=21952 \rightarrow 19^3=6859$$All other numbers end in 1, 512, 4913, 5832, 17576 or 19683 with percentages of approximately 1.5%, 7.6%, 13.0%, 25.7%, 12.7% and 7.5% respectively:$$ \begin{align} 1 \rightarrow 1^3 &= 1\\512 \rightarrow 8^3 &= 512\\4913 \rightarrow 17^3 &= 4913\\5832 \rightarrow 18^3 &= 5832\\17576 \rightarrow 26^3 &= 17576\\19683 \rightarrow 27^3 &=19683 \end{align}$$When we raise the digit sum repeatedly to the fourth power, we find that again that some numbers enter the loop {104976, 531441}, about 33% in total:$$104976 \rightarrow 27^4= 531441 \rightarrow 18^4 = 104976$$All other numbers end in 1, 2401, 234256, 390625, 614656 or 1679616 with approximate percentages of 12.1%, 6.0%, 22.2%, 16.2%, 10.1% and 0.7% respectively:$$ \begin{align}1 \rightarrow 1^4 &= 1\\2401 \rightarrow 7^4 &= 2401\\234256 \rightarrow 22^4&= 234256\\ 390625 \rightarrow 25^4&= 390625\\614656 \rightarrow 28^4 &=614656\\ 1679616 \rightarrow 36^4 &=1679616 \end{align}$$When we raise the digit sum repeatedly to the fifth power, about 56% of numbers enter the loops {16807, 5153632, 9765625, 102400000} or {6436343, 20511149} or {28629151, 45435424}. All other numbers end in 1, 17210368, 52521875, 60466176 or 205962976 with approximate percentages of 1.0%, 4.3%, 11.1%, 33.3% and 5.8% respectively:$$ \begin{align}1 \rightarrow 1^5 &= 1\\17210368 \rightarrow 28^5 &= 17210368\\52521875 \rightarrow 35^5 &= 52521875\\60466176 \rightarrow 36^5&= 60466176\\205962976 \rightarrow 46^5 &=205962976\end{align}$$I could go on but the general pattern is clear.

Tuesday, 16 May 2017

Varieties of Balanced Primes

Recently I passed the 24877 mark. 24877 is a prime number but it's also a balanced prime of order seven, meaning that it is the average of the seven primes preceding it and seven primes succeeding it. The first example of such a prime is 29 because:
$$\textbf{29} = \frac{\overbrace{5 + 7 + 11 + 13 + 17 + 19 + 23}^\text{seven primes below}}{15} \\ + \frac{\textbf{29} + \overbrace{31 + 37 + 41 + 43 + 47 + 53 + 59}^\text{seven primes above}}{15}$$Balanced primes range from order one upwards with the first balanced prime of order one being 5 where:$$\textbf{5}=\frac{3+\textbf{5}+7}{3}$$A subset of the balanced primes are those primes that are doubly balanced, meaning they are averages of both their immediate and their second neighbours. The first example of such a prime is 18731 with surrounding primes of 18713, 18719 below and 18743, 18749 above. We find that:$$ \begin{align} \textbf{18731} &= \frac{18719+\textbf{18731}+18743}{3} \\
&=\frac{18713+18719+\textbf{18731}+18743+18749}{5} \end{align} $$
Primes can be triply balanced (the first of these is 683783), quadruply balanced (the first of these is 98303927) and so on. In terms of the counting of the days of our lives, it is only the first five of the doubly balanced primes (18731, 25621, 28069, 30059 and 31051) that we are likely to encounter.

A prime can be balanced in more ways than one but the orders may not be continuous. A doubly balanced prime like 18713 is a balanced prime of order 1 and order 2. Here the orders, 1 and 2, are continuous. However, a prime like 263 can be written as (257 + 263 + 269)/3 but also (179 + 181 + 191 + 193 + 197 + 199 + 211 + 223 + 227 + 229 + 233 + 239 + 241 + 251 + 257 + 263 + 269 + 271 + 277 + 281 + 283 + 293 + 307 + 311 + 313 + 317 + 331 + 337 + 347 + 349 + 353)/31. It is a balanced prime of order 1 and order 31, but 1 and 31 are not continuous. Both 263 and 18713 are said to be balanced primes of index 2. The balanced primes of index 1 are those that are balanced in one way only, the first of these being 5.

Unlike the doubly balanced primes (18731, 25621, 28069, 30059, 31051 etc.), the balanced primes of index 2 are relatively frequent. Here is a list of the first of them:

211, 263, 349, 397, 409, 439, 709, 751, 787, 827, 1153, 1187, 1259, 1487, 1523, 1531, 2281, 2287, 2347, 2621, 3037, 3109, 3313, 3329, 3539, 3673, 4357, 4397, 4493, 4951, 4969, 4987, 5189, 5303, 5347, 5857, 6323, 6337, 7583, 7907, 7933, 8429, 8713, 8821

After that, they naturally become less frequent. Here are the first balanced primes of index 3:

53, 607, 977, 1289, 2083, 2351, 4013, 5563, 8803, 10657, 11117, 12583, 14747, 16433, 18731, 22067, 22699, 28477, 32833, 39227, 39749, 41957, 44357, 46229, 46643, 50053, 50123, 51869, 53617, 54469, 56167, 63377, 63527, 66797, 74729, 75217

Even the first few balanced primes of index 4 (157, 353, 8233, 23893, 26183 and 30197) will occur within the lives of most individuals.