Thursday, 15 October 2026

Double-Safe and Triple-Safe Primes

A safe prime \(p\) is one such that \( \dfrac{p-1}{2} \) is also prime.
The first example of such a prime is 5 because \( \dfrac{5-1}{2} =2\) which is prime.
However, we can generalise this notion and speak of a \(k\)-safe prime \(p\) where $$ \frac{p-(2^i-1)}{2^i} \text{ is prime for } i=0,1, 2, \dots  k$$Let's look at the various values of \(k\) as applied to a prime \(p\) :

  • \(i=0\) just gives the originating prime \(p\)
  • \(i=1\) means the prime is safe and  \( \dfrac{p-1}{2} \) is prime
  • \(i=2\) means the prime is 2-safe or double-safe and  \( \dfrac{p-3}{4} \) is prime
  • \(i=3\) means the prime is 3-safe or triple-safe and  \( \dfrac{p-7}{8} \) is prime

Let's look at a specific prime, 28319, that is known be a triple safe prime:

  • \(28319\) is prime
  • \(28319 \rightarrow \dfrac{28319-1}{2}  =14159\) which is thus a safe prime
  • \(28319 \rightarrow \dfrac{28319-3}{4} =7079\) which is thus a double-safe prime
  • \(28319 \rightarrow \dfrac{28319-7}{8}  =3539\) which is thus a triple-safe prime
  • \(28319 \rightarrow  \dfrac{28319-15}{16} =1769= 29 \times 61 \) which is not prime
  • These triple-safe primes form OEIS A157358 and the initial members are: 

    23, 47, 719, 1439, 2879, 4079, 9839, 11279, 21599, 28319, 51599, 84719, 92399, 95279, 96959, 137279, 157679, 159119, 178799, 209519, 219839, 243119, 349199, 429119, 430799, 441839, 462719, 481199, 491279, 507359, 533999, 571199, 597599

    As can be seen, 28319 is the last triple-safe prime that I'll see in my lifetime. The double-safe primes form OEIS A066179 and these are more frequent in the range up to 40000:

    11, 23, 47, 167, 359, 719, 1439, 2039, 2879, 4079, 4127, 4919, 5639, 5807, 5927, 6047, 7247, 7559, 7607, 7727, 9839, 10799, 11279, 13799, 13967, 14159, 15287, 15647, 20327, 21599, 21767, 23399, 24407, 24527, 25799, 28319, 28607, 29399, 31607, 35879, 36887

    What about quadruple, quintuple-safe primes and beyond. Up to 40000, there are only three quadruple-safe primes and these are 47, 1439 and 2879. Of these, only 2879 is a quintuple-safe prime (permalink). There is no sextuple-safe prime until we reach 71850239! Up to a billion, there are no septuple-safe primes.

    Wednesday, 14 October 2026

    The Antisigma Function Revisited

    The day after my birthday this year I made a post titled The Antisigma Function. This function returns the sum of the non-divisors of a number and is given by the formula:$$ \text{antisigma}(n)=\frac{n(n+1)}{2}-\sigma(n)$$I noticed today that the number associated with my diurnal age today (28318) has an antisigma value given by:$$ \begin{align} \text{antisigma}(28318) &= 28318 \times 28319/2-\sigma(28318)\\ &=400968721-42480\\ &=400926241 \end{align}$$This antisigma value is almost a multiple of 28318 since:$$ 400926241\!  \! \! \mod 28318 =28315$$This got me wondering whether there are numbers whose antisigma values are multiples of itself. I asked Gemini to investigate and it came to the conclusion that there are no composite integers up to 40,000 (and likely no integers at all) that satisfy this condition. End of story, right. Actually, no. Using the program that Gemini provided I found the following numbers that satisfy (permalink).

    --- Results for Composite Integers 1 to 40000 ---
    Table:
    Composite Integer (n)     | Antisigma Value     
    ------------------------------------------------
    24                        | 240                 
    4320                      | 9318240             
    4680                      | 10937160            
    26208                     | 343351008            
     
    Comma-separated list of the integers:
    24, 4320, 4680, 26208 

    Gemini had to admit its error. So never trust anything Gemini tells you straight up. I then asked if these were the only numbers and it turns out there are infinitely many more. Here is the explanation that Gemini provided:

    For an integer $n$ to divide its antisigma value perfectly, the antisigma expression modulo $n$ must equal 0:
    $$\frac{n(n+1)}{2} - \sigma(n) \equiv 0 \pmod n$$

    For any even number $n$, the formula for the sum of all integers up to $n$ expands to:

    $$\frac{n(n+1)}{2} = \frac{n^2}{2} + \frac{n}{2} = n\left(\frac{n}{2}\right) + \frac{n}{2}$$

    When this triangle number sum is divided by $n$, it consistently leaves a remainder of $\frac{n}{2}$. For the entire antisigma value to be perfectly divisible by $n$, the divisor sum $\sigma(n)$ must also leave a remainder of $\frac{n}{2}$ to exactly cancel out the first remainder. Algebraically, this requires:

    $$\sigma(n) = kn + \frac{n}{2}$$

    Dividing both sides by $n$ reveals the core ratio:

    $$\frac{\sigma(n)}{n} = k + 0.5$$

    Numbers whose abundancy index (the sum of their divisors divided by the number itself) equals a half-integer (such as 1.5, 2.5, or 3.5) belong to a specific mathematical class known as hemiperfect numbers.

    The Online Encyclopedia of Integer Sequences catalogs these half-integral abundancy numbers under OEIS A159907. The first five terms in this sequence are 2, 24, 4320, 4680, and 26208.

    The sequence does not end there. It continues into much larger integers that satisfy the exact same divisibility condition:

    • 8,910,720
    • 17,428,320
    • 20,427,264
    • 91,963,648
    • 197,064,960

    Because there is a massive mathematical "desert" spanning from 26,208 all the way to 8.9 million, a programmatic search capped at a 40,000 limit naturally halts after finding 26,208. Therefore, 24, 4320, 4680, and 26208 are not the only composite integers that divide their antisigma values evenly; they are simply the first four composite entries in a much larger, ongoing sequence.

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

    I wrote about hemiperfect numbers in a post titled Hemiperfect Numbers on the 3rd of January 2021.

    Tuesday, 13 October 2026

    Perimeter of an Ellipse

    I remembered that there was no direct formula for the perimeter of an ellipse unlike the circle where the perimeter or circumference \(C\) is given by the formula \(C=\pi d\) where \(d\) is the diameter of the circle. I asked Gemini to explain the situation. What follows is Gemini's explanation and NOT mine.

    Unlike a circle (\(C = 2\pi r\)), there is no simple, exact algebraic formula for the perimeter (circumference) of an ellipse that uses only elementary functions. The exact perimeter can only be expressed using a mathematical concept known as an elliptic integral.

    However, there are several highly accurate approximations. The definitive way to calculate the perimeter of an ellipse practically is to use the exact integral for theoretical precision, or Srinivasa Ramanujan's first approximation for everyday calculation.

    To use these formulas, you must know two values:

    • \(a\): The semi-major axis (half the length of the longest diameter).
    • \(b\): The semi-minor axis (half the length of the shortest diameter).

    The Best Practical Approximation (Ramanujan)

    In 1914, the mathematician Srinivasa Ramanujan published a brilliant approximation that is incredibly accurate for most ellipses (unless they are extremely elongated, almost resembling a straight line). This is the formula you should use for almost any practical engineering or geometric application:

    \[ P \approx \pi \Big [ 3(a+b) - \sqrt{(3a+b)(a+3b)} \,\Big ] \]

    Example Calculation:
    If your ellipse has a semi-major axis \(a = 5\) and a semi-minor axis \(b = 3\):

    1. Calculate \(3(5+3) = 3(8) = 24\)
    2. Calculate \((3(5)+3)(5+3(3)) = (15+3)(5+9) = (18)(14) = 252\)
    3. Take the square root of 252: \(\sqrt{252} \approx 15.8745\)
    4. Subtract: \(24 - 15.8745 = 8.1255\)
    5. Multiply by \(\pi\): \(\pi \times 8.1255 \approx 25.527\)

    The perimeter is approximately \(25.527 \).

    The Exact Formula (For Absolute Precision)

    If you need the mathematically perfect answer, you must use the complete elliptic integral of the second kind. The exact formula is:

    \[ P = 4a \int_0^{\pi/2} \sqrt{1 - e^2 \sin^2 \theta} \, d\theta \]

    • \(a\) is the semi-major axis.
    • \(e\) is the eccentricity of the ellipse, defined as \(e = \sqrt{1 - \dfrac{b^2}{a^2}}\).

    Because this integral cannot be solved to give a simple polynomial or trigonometric function, it must be evaluated using numerical methods (which computers and advanced calculators do instantly). For the \(a=5, b=3\) example above, a computer evaluating the elliptic integral gives a perimeter of \(25.5269988 \dots \) showing just how incredibly accurate Ramanujan's approximation (25.527) is.

    Beyond 23

    The algorithm that I got Gemini to create and that I used in the post 23 Revisited was the result of the following prompt:

    Write a program in SageMath that determines all the composite, positive integers in a given range that contain the digits 2 and 3 in ascending order from left to right (but not necessarily consecutively) and whose prime factors also all contain the digits 2 and 3 in ascending order but not necessarily consecutively. The default range can be from 1 to 40000. The output should a table showing number and factors followed by a comma-separated list of the qualifying numbers.

    Instead of the prime 23, other prime numbers can be investigated. Composite numbers could be investigated too but this would lead to rather large numbers and so I'll restrict this investigation to prime numbers but I'll increase the range from 1 to one million.

    Here are the results for 11 (permalink):

    Number       | Prime Factors
    ------------------------------
    110231       | 11, 911
    111221       | 11, 10111
    112321       | 11, 10211
    117821       | 11, 10711
    128711       | 11, 11701
    129811       | 11, 11801
    131153       | 11, 11923
    131197       | 11, 11927
    171121       | 211, 811
    211321       | 11, 19211
    231121       | 11, 21011
    232111       | 11, 21101
    261143       | 113, 2311
    351119       | 311, 1129
    451121       | 11, 41011
    511621       | 11, 46511
    781121       | 11, 71011
    892111       | 11, 81101

    Here are the results for 13 (permalink):

    Number       | Prime Factors
    ------------------------------
    13169         | 13, 1013
    16913         | 13, 1301
    22139         | 13, 131
    113269       | 13, 8713
    131729       | 13, 10133
    131807       | 13, 10139
    132703       | 131, 1013
    134069       | 13, 10313
    136669       | 13, 10513
    137069       | 113, 1213
    137969       | 13, 10613
    138781       | 137, 1013
    147013       | 113, 1301
    161369       | 13, 12413
    169013       | 13, 13001
    171301       | 13, 13177
    171379       | 13, 13183
    172133       | 13, 13241
    180713       | 13, 13901
    190013       | 139, 1367
    211303       | 131, 1613
    313469       | 13, 24113
    313729       | 13, 24133
    313781       | 13, 24137
    360139       | 13, 2131
    407213       | 313, 1301
    413473       | 313, 1321
    421369       | 13, 32413
    661369       | 313, 2113
    797513       | 613, 1301
    813397       | 13, 4813
    813451       | 613, 1327

    Here are the results for 17 (permalink):

    Number       | Prime Factors
    ------------------------------
    51731         | 17, 179
    117589       | 17, 6917
    173009       | 17, 10177
    178313       | 17, 617
    198917       | 17, 11701
    217843       | 179, 1217
    291703       | 17, 17159
    295817       | 17, 17401
    301733       | 17, 17749
    308417       | 179, 1723
    351713       | 17, 1217
    368917       | 17, 21701
    506617       | 17, 1753
    517021       | 17, 1789
    541753       | 317, 1709
    717043       | 17, 42179

    Here, and finally, are the results for 19 (permalink):

    Number       | Prime Factors
    ------------------------------
    19361         | 19, 1019
    36119         | 19, 1901
    119467       | 193, 619
    121943       | 197, 619
    193667       | 19, 10193
    194629       | 191, 1019
    196667       | 193, 1019
    251929       | 191, 1319
    361019       | 19, 19001
    361969       | 19, 19051
    366719       | 19, 19301
    370519       | 19, 19501
    371963       | 19, 19577
    376219       | 19, 19801
    381947       | 193, 1979
    519329       | 191, 2719
    601967       | 193, 3119
    714419       | 19, 1979
    719473       | 19, 1993
    752419       | 19, 199
    796519       | 419, 1901

    I won't continue with primes larger than 23 because really what I want is an algorithm that will identify a sequence of digits that form a prime within a number and then check that the same digit sequence occurs with each of its prime factors. The number being checked is thus composite. Here is a permalink to the program that I've now included in my daily number analysis.

    Monday, 12 October 2026

    Details of the Einstein and Spectre Monotiles

    Having read an article in Quanta about the Einstein Tile, I asked Gemini to do some deep research into the topic. It produced a detailed report without a single diagram which was ridiculous and highlights the deficiencies of this sort of report. Lesson learned. Even the Quanta article is sorely lacking in visual support. 

    I opted instead to ask Gemini for a detailed diagram of the original Einstein tile. Figure 1 shows what it came up with.


    Figure 1

    The tile is made up of eight "deltoidal trihexagonal kites", one of which is shown on far right of Figure 1. However, to tile the plane the reflection of the hat is required as shown on the bottom right of Figure 1. The "Spectre" or "Vampire Einstein" monotile fixes this problem (see Figure 2).


    Figure 2

    I made the following observation:
    The Spectre tile is clearly not a polygon. Wasn't the aim to fill 2-D space with a suitable polygon. Does this mean that there is no vampire monotile that is a polygon?
    Here was Gemini's response:
    Does a truly "polygonal" vampire monotile exist?

    Actually, yes! Although curves are the easiest way to visualize the "Spectre's" chiral enforcement, you can replace those curves with polygonal (jagged) features.

    If instead of smooth curves you use jagged, puzzle-like zig-zagged sub-edges (effectively turning the 14-sided tile into a vastly more complex polygon with many tiny, straight-line notches), you can strictly forbid reflection without using a single curve. However, doing so requires creating a heavily complex, jagged polygon with dozens of vertices, which makes it much harder to print, analyze, or illustrate clearly on a grid.

    For simplicity, mathematicians and illustrators typically show the smooth-curved Spectre as the definitive "vampire monotile" because it naturally forces its own chirality without the visual clutter of dozens of tiny polygonal zig-zags.

    Friday, 9 October 2026

    23 Revisited

    The number 23 never ceases to be of interest. Back in November of 2020 I made a post titled Twenty Three in which I looked at some of the properties of this prime number. These included the following:

    • 23 and 239 are the only integers requiring nine positive cubes for their representation
    • 23 has a reciprocal with a period of 22
    • 23 features in and is central to the birthday paradox
    • 23 is a Sophie Germain and safe prime
    • 23 forms part of the first Cunningham chain 2, 5, 11, 23, 47
    • 23 is the smallest odd prime that is not a twin prime
    • 23 is the second Woodell prime (the first is 7)
    • 23 is a factorial prime equal to 4! -1
    • 23 is the second Smarandache–Wellin prime (the first is 2)
    • 23 divides 874, the sum of the first 23 primes
    • 23 is the length of the repunit prime 11111111111111111111111
    • 23 is the only prime \(p\) such that \(p!\) is \(p\) digits long
    • 23 is conjectured to be the only pointer prime that does not contain a 1
    The number associated with my diurnal age today, 28313, caught my attention because the number 23 stood out:$$ \textcolor{red}{2}8\textcolor{red}{3}13 = \textcolor{red}{23} \times 1\textcolor{red}{23}1 $$I wondered how common this sort of pattern was so I asked Gemini to write a program to find out. This was the prompt:
    Write a program in SageMath that determines all the composite, positive integers in a given range that contain the digits 2 and 3 in ascending order from left to right (but not necessarily consecutively) and whose prime factors also all contain the digits 2 and 3 in ascending order but not necessarily consecutively. The default range can be from 1 to 40000. The output should a table showing number and factors followed by a comma-separated list of the qualifying numbers.

    Here is a permalink to the program that returned only one result: 28313. Extending the range to 100,000 gives us the following numbers:

    Number     | Prime Factors
    --------------------------------------------------
    28313      | 23, 1231
    52739      | 23, 2293
    58213      | 23, 2531
    62399      | 23, 2713
    62813      | 23, 2731

    It is only when we extend the range to one million that we find numbers such that the 23's  are all formed from consecutive digits. I modified the prompt and got Gemini to create a new program:
    Write a program in SageMath that determines all the composite, positive integers in a given range that contain the digits 2 and 3 consecutively in ascending order from left to right and whose prime factors also all contain the digits 2 and 3 consecutively in ascending order. The default range can be from 1 to one million. The output should be a table showing number and factors followed by a comma-separated list of the qualifying numbers (permalink).

    Here are the results when the program is run: 

    123257, 235129, 282923, 286823, 442313, 523381, 533623, 542363, 547423, 552329, 555239, 563323, 672313, 902359, 985823

    Number       | Prime Factors
    --------------------------------------------------
    123257       | 23, 233
    235129       | 23, 10223
    282923       | 23, 12301
    286823       | 233, 1231
    442313       | 23, 19231
    523381       | 223, 2347
    533623       | 23, 23201
    542363       | 23, 23581
    547423       | 23, 23801
    552329       | 239, 2311
    555239       | 233, 2383
    563323       | 239, 2357
    672313       | 23, 29231
    902359       | 23, 39233
    985823       | 233, 4231

    These numbers of course are far beyond what my diurnal age will ever reach but we can identify 29231 as a special number because it contains the digit sequence 23 and when multiplied by 23 produces a new number, 672313, that also contains the digit sequence 23. I may reach this number but it's doubtful whether I'll reach the next (39233) that has the same property. 

    Thursday, 8 October 2026

    When Dates and Days Align

    I put this little problem to Gemini:

    A person is born on April 3rd 1949. The day that he is born is reckoned as Day 0 and for every subsequent day 1 is added and this count becomes his diurnal age. Let the number associated with any date be determined as DDMYY where DD is the number associated with the month(1 to a maximum of 31), M is the month (from 1 to 9) and YY is the last two digits of the current year. Thus a date of 14th September 2026 would become 14926. Is there any date, using this system, where the diurnal age equals the date?

    Here was its response:

    September 23, 2014, is the sole date where the diurnal age mathematically equates to its DDMYY numerical representation. 

    That is interesting and so, on the 23rd of September 2014, I was 23914 days old. I got Gemini to write a program that would accept any birthdate as input using this prompt:

    Can you write a program in SageMath that will accept any birthdate as input and from there calculate if there is a date where the diurnal age equals the date number using DDMYY format. Let’s realistically limit the person’s possible age to less than 100.  

    Here is a permalink to the program and the result for the following birthdate:

    • 23rd August 1964:
      Match found: 05 February 1979 | Diurnal Age / Date Number: 5279
    However, I realised that I could be less restrictive with the date format and modified the prompt as follows:
    I’d like to modify the program so the acceptable date format can be DMMYY, DDMYY or DMYY. This ensures that the resultant number derived from the date is always less than six digits. Everything else remains the same.

    Here is a permalink to the modified program which produces the same results for the two dates examined above. Here are some additional dates:

    • 23rd November 1980:
      Match found: 06 July 1999 | Diurnal Age: 6799 | Date Format: 6799
      Match found: 16 January 2025 | Diurnal Age: 16125 | Date Format: 16125

    • 6th October 2002:
      Match found: 10 September 2032 | Diurnal Age: 10932 | Date Format: 10932

    So just a little curiosity. Not all birthdates yield a result within the span of 100 years. You could ask the person born on the 6th October 2002: h
    ow many days old will you be on the 10th September 2032? Don't know? Here's a way to find out:
    • 10th \( \rightarrow\) 10
    • September \( \rightarrow\) 9
    • 2032 \( \rightarrow\)  32
    • Concatenation \( \rightarrow\) 10932 \( \rightarrow\) your diurnal age!