Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Monday, 18 May 2026

Base 10 Primes in Higher Number Bases

The thought struck me as to what primes in base 10 remain prime when the digits stay the same but the number base increases to 11, 12, 13 etc. I got Gemini to investigate and it came up with useful summary and an impressive interactive tool for investigation:

To analyze this integer sequence mathematically, we can define the transformation as evaluating a polynomial.

Let a base-10 prime \( p \) have the decimal representation \( d_k d_{k-1} \dots d_1 d_0 \). The value of \( p \) is given by:

\[ p = \sum_{i=0}^{k} d_i 10^i \]

When we take these same digits and interpret them in a higher base \( b \) (where \( 11 \le b \le 36 \)), we are evaluating the new integer \( P_b \):

\[ P_b = \sum_{i=0}^{k} d_i b^i \]

The task is to find all instances where both \( p \) and \( P_b \) are prime. When we run this analysis across different bases, distinct number-theoretic patterns emerge, particularly regarding parity and divisibility.

The Parity Sieve for Odd Bases

The parity of the new number \( P_b \) depends entirely on whether the target base \( b \) is odd or even.

If the target base \( b \) is odd (e.g., base 11, 13, 15), then \( b \equiv 1 \pmod 2 \). Consequently, the modulo-2 value of the new number collapses to the sum of its digits:

\[ P_b \equiv \sum_{i=0}^{k} d_i \pmod 2 \]

This creates a massive sieve: if the sum of the digits of the original prime \( p \) is even, \( P_b \) will inevitably be even. Since \( P_b > 2 \) for all target primes in these higher bases, an even \( P_b \) is strictly composite. Therefore, odd bases yield a significantly sparser sequence of primes.

The Density in Even Bases

If the target base \( b \) is even (like the default \( b=16 \)), then \( b \equiv 0 \pmod 2 \). In this scenario, all terms multiplied by \( b \) are even, meaning the parity of \( P_b \) relies solely on the final digit \( d_0 \):

\[ P_b \equiv d_0 \pmod 2 \]

Because \( p \) is prime in base-10, its final digit \( d_0 \) must be odd (1, 3, 7, or 9) with the sole exception of \( p=2 \). Therefore, \( P_b \) will always be odd in an even base. Because they bypass the digit-sum parity trap, even bases like 16 retain a much higher density of prime numbers.

Small Examples in Base 16

For \( b=16 \), examining the first few base-10 primes reveals the retention rate:

  • 11: \( 1(16) + 1 = 17 \) (Prime)
  • 13: \( 1(16) + 3 = 19 \) (Prime)
  • 17: \( 1(16) + 7 = 23 \) (Prime)
  • 19: \( 1(16) + 9 = 25 \) (Composite, \( 5 \times 5 \))
  • 23: \( 2(16) + 3 = 35 \) (Composite, \( 5 \times 7 \))
  • 29: \( 2(16) + 9 = 41 \) (Prime)

To thoroughly investigate the sequence up to 40,000 across any base from 11 to 36 without relying on a static, truncated list, the interactive tool below is designed to compute the results dynamically. It handles the base conversions and primality testing locally within your browser.

Total Primes Found: 0
Index Base 10 Prime Value in Target Base

Monday, 24 November 2025

Conway's Game of Life Revisited

The reason that I stopped recording how the digits of my diurnal age behaved under Conway's Game of Life rules was that it was tedious entering the individual squares that made up the digits in the initial configuration. See Figure 1.

Figure 1: the number is made up of over 50 squares

Given Gemini 3.0's capabilities however, I thought I'd revisit this issue and get it to write a program that allows me to simply enter the above digits, 27380, and have the configuration appear on the grid as shown in Figure 1 without my having to manually enter each square. After that the program runs according to the Game of Life rules until a stable state is reached. 

The program had a great deal of trouble determing what constituted a stable state because the spaceships kept moving on their eternal trajectories. This motion was being regarded as a stable state not being reached, which in a sense it isn't, but once the spaceships head off on their trajectories, they just have to be forgotten about. Anyway, I compromised and got the program to display on ongoing count of generations that I could manually stop and move backwards or forwards if required once I hit pause. Here is a link to the simulation:

https://sites.google.com/view/gameoflifesimulation?usp=sharing

Figure 2 shows the interface and the initial state when the number 27994 has been entered. Even though I entered the "7" as shown in Figure 1 when constructing my initial prompt, Gemini took it upon itself to alter the way the "7" was rendered on the grid. Now that I see it, I find the shape preferable to my original so I'm not planning to change it.


Figure 2: initial state once 27994 has been entered

The final stable state that is reached after 59 generations is shown in Figure 3. It correctly identifies that there are two still lifes and one oscillator remaining. The "Period: 2" in the black box presumably refers to the fact that the oscillator has two possible shapes.


Figure 3: final state resulting from an input of 27994