Showing posts with label bases. Show all posts
Showing posts with label bases. Show all posts

Sunday, 6 September 2026

Rhonda Numbers Revisited

I first reviewed Rhonda Numbers in an eponymous post on the 16th October 2018. Read that post to find out what defines such numbers. Today, upon turning 28280 days old, I was reminded of them again because this number is a member of OEIS A255731:


A255731: Rhonda numbers in sexagesimal number system.

The program that I wrote back then only covered bases from 2 to 36 so I got Gemini to write a new SageMath program that would accommodate every base. Here is what is generated as output when asked to find all Rhonda numbers in base 60 in the range up to one million (permalink):

3348, 3510, 6750, 17430, 18750, 18876, 18944, 19475, 20564, 21312, 26550, 28280, 37230, 38396, 43940, 48042, 77770, 88270, 91224, 97470, 108882, 111403, 120046, 123630, 181996, 182646, 235467, 253460, 260429, 264735, 278675, 289161, 295960, 296055, 306642, 324394, 325593, 337040, 348641, 361221, 377130, 378444, 398274, 411342, 412930, 441048, 444405, 450528, 453470, 458136, 469098, 499533, 503310, 517803, 533731, 534795, 541807, 547515, 566754, 598695, 612374, 612870, 626535, 630410, 656370, 656750, 667491, 670548, 684456, 701765, 703304, 705256, 706275, 709475, 720279, 750225, 757576, 762745, 765245, 809107, 812658, 821106, 877300, 880045, 881454, 915348, 927303, 929830, 930304, 936573, 936675, 967509, 972196, 973549, 984485, 986895, 998430

I also realised that I hadn't included the identification of Rhonda numbers in my daily number analysis and that deficiency has now been remedied. Here the output of the program that I got Gemini to write for the input 29280 (permalink):

28280 : determination of whether it is a Rhonda number in a given base

--- Evaluating 28280 in Base 60 ---

1. Base-60 Digits: [7, 51, 20]

2. Digit Product: 7 * 51 * 20 = 7140

3. Prime Factorization: 2^3 * 5 * 7 * 101

4. Sum of Factors: 2 + 2 + 2 + 5 + 7 + 101 = 119

5. Target Equation (Base * Sum): 60 * 119 = 7140

RESULT: True. 28280 IS a Rhonda number in base 60.

I've set the range of bases to be investigate to 100,000 so that even a number like 889200 with is a Rhonda number in TEN different bases has an accurate output:

--- Evaluating 889200 in Base 1512 ---

1. Base-1512 Digits: [588, 144]

2. Digit Product: 588 * 144 = 84672

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 1512 * 56 = 84672

RESULT: True. 889200 IS a Rhonda number in base 1512.

-----------------------------------

--- Evaluating 889200 in Base 2760 ---

1. Base-2760 Digits: [322, 480]

2. Digit Product: 322 * 480 = 154560

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 2760 * 56 = 154560

RESULT: True. 889200 IS a Rhonda number in base 2760.

-----------------------------------

--- Evaluating 889200 in Base 5160 ---

1. Base-5160 Digits: [172, 1680]

2. Digit Product: 172 * 1680 = 288960

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 5160 * 56 = 288960

RESULT: True. 889200 IS a Rhonda number in base 5160.

-----------------------------------

--- Evaluating 889200 in Base 7904 ---

1. Base-7904 Digits: [112, 3952]

2. Digit Product: 112 * 3952 = 442624

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 7904 * 56 = 442624

RESULT: True. 889200 IS a Rhonda number in base 7904.

-----------------------------------

--- Evaluating 889200 in Base 9400 ---

1. Base-9400 Digits: [94, 5600]

2. Digit Product: 94 * 5600 = 526400

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 9400 * 56 = 526400

RESULT: True. 889200 IS a Rhonda number in base 9400.

-----------------------------------

--- Evaluating 889200 in Base 10032 ---

1. Base-10032 Digits: [88, 6384]

2. Digit Product: 88 * 6384 = 561792

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 10032 * 56 = 561792

RESULT: True. 889200 IS a Rhonda number in base 10032.

-----------------------------------

--- Evaluating 889200 in Base 11440 ---

1. Base-11440 Digits: [77, 8320]

2. Digit Product: 77 * 8320 = 640640

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 11440 * 56 = 640640

RESULT: True. 889200 IS a Rhonda number in base 11440.

-----------------------------------

--- Evaluating 889200 in Base 12920 ---

1. Base-12920 Digits: [68, 10640]

2. Digit Product: 68 * 10640 = 723520

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 12920 * 56 = 723520

RESULT: True. 889200 IS a Rhonda number in base 12920.

-----------------------------------

--- Evaluating 889200 in Base 14136 ---

1. Base-14136 Digits: [62, 12768]

2. Digit Product: 62 * 12768 = 791616

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 14136 * 56 = 791616

RESULT: True. 889200 IS a Rhonda number in base 14136.

-----------------------------------

--- Evaluating 889200 in Base 15080 ---

1. Base-15080 Digits: [58, 14560]

2. Digit Product: 58 * 14560 = 844480

3. Prime Factorization: 2^4 * 3^2 * 5^2 * 13 * 19

4. Sum of Factors: 2 + 2 + 2 + 2 + 3 + 3 + 5 + 5 + 13 + 19 = 56

5. Target Equation (Base * Sum): 15080 * 56 = 844480

RESULT: True. 889200 IS a Rhonda number in base 15080.

-----------------------------------

Thursday, 30 April 2026

Unprimeable Versus Weakly Prime Numbers

Let's clarify the distinction between these two types of numbers:

Unprimeable numbers are composite numbers that remain composite regardless of which single digit is changed to another. These numbers are essentially "immune" to becoming prime through a single-digit modification in base 10, with 200 being the smallest example. 

Key Facts about Unprimeable Numbers:

  • Definition: A composite number is unprimeable if changing one digit to any other digit (0-9) never produces a prime number. 
  • Smallest Examples: The sequence begins 200, 204, 206, 208, 320, 322, 324, 325, 326, 328, .... 
  • Example Case (200): Modifying the first, second, or third digit of 200 always results in a composite number (e.g., changing 200 to 100, 300, 210, 201, etc.). 
  • Differentiation: They are sometimes confused with "weakly primes", which are actual prime numbers that cannot be turned into a different prime by changing a single digit.

The reason that I sought the clarification is that the number associated with my diurnal age today, 28151, has a property that allows it membership of OEIS A186995:


  A186995: smallest weak prime in base \(n\).

The initial members of this sequence, up to base 16, are:

127, 2, 373, 83, 28151, 223, 6211, 2789, 294001, 3347, 20837899, 4751, 6588721, 484439, 862789

28151 corresponds to base 6 where it has the representation 334155. This large value surprised me and so I asked Gemini:

OEIS A186995 lists the smallest weak prime in base n and it begins with 127, 2, 373, 83, 28151, 223, 6211, 2789, 294001, 3347, 20837899, 4751, 6588721, 484439, 862789 etc. starting with n=2. When we get to n=6, the base 6 equivalent of 28151 is 334155 but I find it hard to believe that in the first 28150 base 6 numbers there are none that are weakly prime. Can you explain how this is so in the case of base 6.

This was the response: 

The reason the smallest weakly prime number in base 6 jumps so drastically to 28151 (which is 334155 in base 6) lies in the prime factorization of the base itself. Because 6 is the product of the two smallest prime numbers, 2 and 3, it creates a mathematical "divisibility shield" that makes it statistically extremely difficult for a base 6 number to qualify as weakly prime.

Here is the step-by-step mechanics of how this works:

The Mechanics of Digit Substitution

In base 6, a number N is constructed from its digits as:

N = d6k + dk-1 6k-1 + … + d61 + d60

For a number to be weakly prime, it must first be prime. If N is prime (and greater than 3), it cannot be divisible by 2 or 3. This means it must be an odd number, and it cannot be a multiple of 3.

When you modify a digit di to a new value c (where c is between 0 and 5), the difference between the new number and the original prime N is exactly (c − di) 6i.

The Divisibility Shield

For any digit position i ≥ 1, the place value 6i is always a multiple of 6. Therefore, the difference (c − di) 6i is always an even number and always a multiple of 3.

When you add or subtract a multiple of 2 and 3 to a prime number N, the resulting number maintains the exact same divisibility properties as N modulo 2 and modulo 3. Consequently, any substitution made to the 61, 62, 63 … positions will never produce a number divisible by 2 or 3.

The Statistical Improbability

To satisfy the weakly prime condition, every possible digit substitution must result in a composite number.

In the general integer population, about 66.7% of all numbers are composite simply by being even or a multiple of 3. However, because of the divisibility shield, none of the modified numbers from the higher digit positions can take this "easy" path to being composite. They are forced into the remaining 33.3% of the number line—numbers coprime to 6—where the density of primes is three times higher.

For 334155 in base 6, there are 5 higher digit positions (i ≥ 1), and changing them to the other 5 valid digits yields 25 different modified numbers. All 25 of these must simultaneously be composite, but their prime factors must be drawn exclusively from larger primes (5, 7, 11, 13, etc.). Finding a cluster where 25 specific numbers coprime to 6 all happen to hit composite numbers requires venturing much further up the number line, which is why the sequence jumps so violently to 28151.

You can observe this exact same behavior in OEIS A186995 whenever the base has multiple distinct prime factors. For base 10 (factors 2 and 5), the smallest weakly prime is 294001. For base 12 (factors 2 and 3), it rockets to 20837899. Conversely, in a prime base like base 5 (where the answer is just 83), changing a higher digit easily flips the number from odd to even, quickly satisfying the composite requirement.

Monday, 15 December 2025

Emirpimes In Bases Greater Than 10

Why stop at bases between 2 and 9? I prompted Gemini again:

Can this program be modified so that it can investigate numbers in bases from 11 to 16? I know this is more difficult because of the necessary use of letters as well as the digits from 0 to 9.  

The program that it came up with works in bases from 2 to 36 which is impressive. I'll include the code and Gemini's explanation of it after the tables that cover bases of 11, 12, 13, 14, 15 and 16.

BASE 11


Table 1: permalink

BASE 12


Table 2: permalink

BASE 13


Table 3: permalink

BASE 14


Table 4: permalink

BASE 15


Table 5: permalink

BASE 16


Here is the code and what Gemini had to say about it. 

Yes, this can definitely be done. The core logic of the mathematics (checking primes and reversing lists of numbers) remains exactly the same. The only complexity is visual: we need to translate the internal numbers (10, 11, 12, etc.) into their representative symbols (A, B, C, etc.) so they are readable in the output.

Here is the upgraded program. It now includes a DIGIT_MAP to handle bases up to 16 (and actually up to 36, if you wanted to go higher).

The Upgraded Python Program (Bases 2–16)

Python
# ==========================================
#  CONFIGURATION (User Inputs)
# ==========================================
SEARCH_BASE = 16          # Supports bases 2 through 16
SEARCH_RANGE = (1, 60000) # Range to search [start, end]

# ==========================================
#  CORE FUNCTIONS
# ==========================================

# Standard mapping for bases > 10
DIGIT_MAP = "0123456789ABCDEF"

def to_base(n, b):
    """Converts an integer n to a list of digit values in base b."""
    if n == 0:
        return [0]
    digits = []
    while n:
        digits.append(int(n % b))
        n //= b
    return digits[::-1]

def from_base(digits, b):
    """Converts a list of digit values in base b back to an integer."""
    n = 0
    for d in digits:
        n = n * b + d
    return n

def get_reversed_val(n, b):
    """Returns the integer value of n with its digits reversed in base b."""
    digits = to_base(n, b)
    # We reverse the list of values (e.g. [1, 15] becomes [15, 1])
    return from_base(digits[::-1], b)

def is_prime(n):
    """Efficient primality test."""
    if n <= 1: return False
    if n <= 3: return True
    if n % 2 == 0 or n % 3 == 0: return False
    i = 5
    while i * i <= n:
        if n % i == 0 or n % (i + 2) == 0:
            return False
        i += 6
    return True

def get_semiprime_factors(n):
    """
    Returns [p, q] if n is a semiprime.
    Returns None otherwise.
    """
    factors = []
    d = 2
    temp = n
    # Optimization: limit search to sqrt(temp)
    while d * d <= temp:
        while temp % d == 0:
            factors.append(d)
            temp //= d
            if len(factors) > 2: 
                return None
        d += 1
    if temp > 1:
        factors.append(temp)
    
    if len(factors) == 2:
        return factors
    return None

def format_in_base(n, b):
    """
    Returns string representation of n in base b using 0-9 and A-F.
    """
    digits = to_base(n, b)
    # Map integer values (e.g., 10) to characters (e.g., 'A')
    return "".join(DIGIT_MAP[d] for d in digits)

# ==========================================
#  MAIN EXECUTION
# ==========================================

print(f"Searching for special Emirpimes in Base {SEARCH_BASE} between {SEARCH_RANGE}...")
print(f"Format: Base 10 | Base {SEARCH_BASE} | Factors (Base {SEARCH_BASE}) | Reversed (Base {SEARCH_BASE}) | Rev Factors (Base {SEARCH_BASE})")
print(f"{'-'*110}")

count = 0
start, end = SEARCH_RANGE

for n in range(start, end + 1):
    # 1. Check if semiprime
    factors = get_semiprime_factors(n)
    if not factors:
        continue
    
    p, q = factors[0], factors[1]
    
    # 2. Get reversed values in the target base
    n_rev_val = get_reversed_val(n, SEARCH_BASE)
    p_rev_val = get_reversed_val(p, SEARCH_BASE)
    q_rev_val = get_reversed_val(q, SEARCH_BASE)
    
    # 3. Check Condition 1: Factors must be 'Emirps' in this base
    # (Reversed factors must be prime)
    if not (is_prime(p_rev_val) and is_prime(q_rev_val)):
        continue
        
    # 4. Check Condition 2: The "Special" Multiplication Property
    # Rev(n) == Rev(p) * Rev(q)
    if n_rev_val == (p_rev_val * q_rev_val):
        
        # Prepare output strings using the Alpha-Numeric formatter
        n_str = format_in_base(n, SEARCH_BASE)
        p_str = format_in_base(p, SEARCH_BASE)
        q_str = format_in_base(q, SEARCH_BASE)
        
        n_rev_str = format_in_base(n_rev_val, SEARCH_BASE)
        p_rev_str = format_in_base(p_rev_val, SEARCH_BASE)
        q_rev_str = format_in_base(q_rev_val, SEARCH_BASE)
        
        factors_str = f"{p_str} x {q_str}"
        rev_factors_str = f"{p_rev_str} x {q_rev_str}"

        # Print formatted columns
        print(f"{n:<10} | {n_str:<10} | {factors_str:<20} | {n_rev_str:<20} | {rev_factors_str:<20}")
        count += 1

print(f"{'-'*110}")
print(f"Found {count} special emirpimes in Base {SEARCH_BASE}.")

Key Improvements

  1. DIGIT_MAP = "0123456789ABCDEF": This string acts as a lookup table. If a digit value is 15, the code looks at index 15 and retrieves 'F'.

  2. format_in_base: This function was rewritten to use the lookup table, ensuring that any number from 10 to 15 is printed as a letter.

  3. Universal Logic: This version works for any base from 2 to 16 without needing further changes. You simply change SEARCH_BASE = 16, 12, or 8 at the top.

Example: What to expect in Base 16 (Hexadecimal)

If you run this with SEARCH_BASE = 16, you might see results involving the digit 'A' (10) or 'C' (12), provided the "no carrying" rule is met.

  • Example: If we had $13 \times 13 = 169$ in Base 10, in Base 16 this is $D \times D = A9$.

  • Since $D$ (13) is a single digit, reversing it changes nothing, so it acts like a palindrome.

  • However, finding multi-digit primes in Base 16 that don't "carry" when multiplied is harder because the "digits" are larger, but the slots fill up differently.