← All Duels

gemini-2.5-flash_vs_gemini-3-pro-preview_20260124_082809.jsonl — 10 puzzles

gemini-2.5-flash
-2
vs
gemini-3-pro-preview
2
#1 Sample Solution Wrong
import math

def mystery(x):
    """
    This function checks for specific, non-obvious properties
    depending on whether the input x is a string or an integer.
    """

    def is_prime(n):
        """Helper function to check if a number is prime."""
        if n < 2:
            return False
        for i in range(2, int(math.sqrt(n)) + 1):
            if n % i == 0:
                return False
        return True

    try:
        if isinstance(x, str):
            # Condition 1: The string must consist purely of digits.
            if not x.isdigit():
                return False
            
            num_val = int(x)
            
            # Condition 2: The numerical value of the string must be a perfect square.
            if num_val < 0: # Perfect squares are non-negative
                return False
            sqrt_val = int(math.sqrt(num_val))
            if sqrt_val * sqrt_val != num_val:
                return False
            
            # Condition 3: The length of the string must be odd.
            if len(x) % 2 == 0:
                return False
            
            # Condition 4: The string must contain exactly one digit '3'.
            if x.count('3') != 1:
                return False
            
            # Condition 5: The sum of the ASCII values of all characters in the string
            # must be a prime number.
            ascii_sum = sum(ord(c) for c in x)
            if not is_prime(ascii_sum):
                return False
            
            return True # All string conditions met

        elif isinstance(x, int):
            # Condition 1: The integer must be positive.
            if x <= 0:
                return False
            
            str_val = str(x)
            
            # Condition 2: The string representation of the integer must not contain the digit '0'.
            if '0' in str_val:
                return False
            
            # Condition 3: The length of the string representation must be at least 3.
            if len(str_val) < 3:
                return False
            
            # Condition 4: The integer must be a "Disarium number".
            # A Disarium number is a number in which the sum of its digits raised
            # to the power of their respective positions is equal to the number itself.
            # (Positions are 1-indexed from the left).
            sum_of_powers = 0
            for i, digit_char in enumerate(str_val):
                digit = int(digit_char)
                sum_of_powers += digit ** (i + 1) # i is 0-indexed, so i+1 for 1-indexed position
            
            return sum_of_powers == x # All integer conditions met
            
        else:
            # If x is neither a string nor an integer, it returns False.
            return False
            
    except ValueError:
        # Handles cases where int(x) fails for a string (e.g., "abc")
        return False
    except OverflowError:
        # Handles cases with extremely large numbers that cause overflow
        return False
    except Exception:
        # Catch any other unexpected errors
        return False
"13456"
Proposer: gemini-2.5-flash Solver: gemini-3-pro-preview
-1 vs 0
#2 Solved
def mystery(x):
    """
    Validates a string based on character properties and a 
    simulated path traversal on a grid.
    """
    if not isinstance(x, str):
        return False
    
    # 1. Length Check
    if len(x) != 6:
        return False
        
    # 2. ASCII Sum Check
    # The sum of ASCII values of all characters must equal 609.
    if sum(ord(c) for c in x) != 609:
        return False
        
    # 3. Composition Check
    # Must contain exactly two occurrences of the letter 'n'.
    if x.count('n') != 2:
        return False
        
    # 4. Prefix Check
    if not x.startswith('b'):
        return False

    # 5. Path Simulation
    # Simulates movement on a 4x4 grid (indices 0-3).
    # The grid cells are numbered 1 to 16 in row-major order.
    # Starting position is (0, 0) with initial accumulated value of 1.
    r, c = 0, 0
    acc = 1
    
    for char in x:
        # Movement rule:
        # Even ASCII value -> Move Right (column + 1)
        # Odd ASCII value  -> Move Down (row + 1)
        if ord(char) % 2 == 0:
            c += 1
        else:
            r += 1
            
        # Boundary Check: Must stay within 4x4 grid
        if r > 3 or c > 3:
            return False
            
        # Accumulate the value of the current cell
        # Cell value = row * 4 + col + 1
        acc += (r * 4 + c + 1)
        
    # 6. Destination Check
    # Must end exactly at the bottom-right corner (3, 3).
    if (r, c) != (3, 3):
        return False
        
    # 7. Path Sum Check
    # The sum of values of all visited cells (including start) must be 55.
    return acc == 55
"banana"
"banana"
Proposer: gemini-3-pro-preview Solver: gemini-2.5-flash
-1 vs 0
#3 Solved
import math

def mystery(x):
    """
    This function checks for complex properties based on whether the input x
    is a string or an integer, involving numerical values of characters,
    digit properties, and number classifications.
    """

    def is_prime(n):
        """Helper function to check if a number is prime."""
        if n < 2:
            return False
        for i in range(2, int(math.sqrt(n)) + 1):
            if n % i == 0:
                return False
        return True

    def get_char_numerical_value(char):
        """Helper function to get a=1, b=2, ..., z=26."""
        if 'a' <= char <= 'z':
            return ord(char) - ord('a') + 1
        return -1 # Invalid character

    def is_palindrome_number(n):
        """Helper function to check if a number is a palindrome."""
        if n < 0: return False
        return str(n) == str(n)[::-1]
    
    def is_happy(n):
        """Helper function to check if a number is a Happy Number."""
        if n <= 0: return False
        seen = set()
        current = n
        while current != 1 and current not in seen:
            seen.add(current)
            current = sum(int(digit)**2 for digit in str(current))
        return current == 1

    def is_perfect_power(n):
        """Helper function to check if a number is a perfect power (m^k for integers m > 1, k > 1)."""
        if n <= 1: return False
        # Check for powers up to log2(n) for exponent k
        for k in range(2, int(math.log2(n)) + 2):
            # Calculate m = n^(1/k) and round to nearest integer
            m = round(n**(1/k))
            # Check if m^k actually equals n
            if m**k == n:
                return True
        return False

    try:
        if isinstance(x, str):
            # Condition 1: The string must consist only of lowercase English letters.
            if not x.islower() or not x.isalpha():
                return False
            
            # Condition 2: The length of the string must be exactly 5 characters.
            if len(x) != 5:
                return False
            
            # Condition 3: The string must contain exactly one vowel (a, e, i, o, u).
            vowels = "aeiou"
            vowel_count = sum(1 for char in x if char in vowels)
            if vowel_count != 1:
                return False
            
            # Condition 4: The sum of the ASCII values of all characters in the string
            # must be a perfect square.
            ascii_sum = sum(ord(c) for c in x)
            sqrt_sum = int(math.sqrt(ascii_sum))
            if sqrt_sum * sqrt_sum != ascii_sum:
                return False
            
            # Condition 5: The numerical value of the character at the 3rd position
            # (0-indexed, so x[2]) must be a prime number (where a=1, b=2, ..., z=26).
            char_val_third_pos = get_char_numerical_value(x[2])
            if not is_prime(char_val_third_pos):
                return False
            
            return True # All string conditions met

        elif isinstance(x, int):
            # Condition 1: The integer must be positive.
            if x <= 0:
                return False
            
            # Condition 2: The integer must be a 4-digit number.
            if not (1000 <= x <= 9999):
                return False
            
            # Condition 3: The integer must be a "Happy Number".
            # A Happy Number is a number that eventually reaches 1 when replaced by the
            # sum of the square of each digit.
            if not is_happy(x):
                return False
            
            # Condition 4: The integer must be a "Perfect Power".
            # A Perfect Power is an integer n that can be expressed as m^k
            # for integers m > 1 and k > 1.
            if not is_perfect_power(x):
                return False
            
            # Condition 5: The sum of the digits of the integer must be a "palindrome number".
            # A palindrome number reads the same forwards and backwards (e.g., 121, 5, 4334).
            sum_digits = sum(int(digit) for digit in str(x))
            if not is_palindrome_number(sum_digits):
                return False
            
            return True # All integer conditions met
            
        else:
            # If x is neither a string nor an integer, it returns False.
            return False
            
    except ValueError:
        # Handles cases where int(x) fails for a string (e.g., "abc")
        return False
    except OverflowError:
        # Handles cases with extremely large numbers that cause overflow
        return False
    except Exception:
        # Catch any other unexpected errors
        return False
1000
"bceny"
Proposer: gemini-2.5-flash Solver: gemini-3-pro-preview
-1 vs 0
#4 Solver Failed
def mystery(x):
    """
    Validates a 'DNA' sequence based on structural, compositional, 
    and energetic constraints.
    """
    # 1. Type and Length Check
    if not isinstance(x, str) or len(x) != 10:
        return False
    
    # 2. Alphabet Check
    # Must only contain DNA bases (uppercase).
    allowed = set('ACGT')
    if not set(x).issubset(allowed):
        return False
        
    # 3. Pair Balance
    # In this hypothetical strand, Adenine (A) must equal Thymine (T),
    # and Cytosine (C) must equal Guanine (G).
    if x.count('A') != x.count('T') or x.count('C') != x.count('G'):
        return False
        
    # 4. Stability Check
    # No base can be repeated consecutively (e.g., 'AA' is forbidden).
    if any(x[i] == x[i+1] for i in range(len(x) - 1)):
        return False
        
    # 5. Motif Check
    # The sequence must contain the specific catalytic triad 'CAT'.
    if 'CAT' not in x:
        return False

    # 6. Energetic Resonance
    # The sequence's weighted ASCII sum must be a multiple of 13.
    # The weight is determined by the character's 1-based position.
    # Formula: sum(ASCII_value * (index + 1))
    weighted_sum = sum(ord(c) * (i + 1) for i, c in enumerate(x))
    
    return weighted_sum % 13 == 0
"GCAGTCGTAC"
"TATGACATGC"
Proposer: gemini-3-pro-preview Solver: gemini-2.5-flash
-1 vs 1
#5 Solved
import math

def mystery(x):
    """
    This function evaluates properties of the input x, taking distinct paths
    for strings and integers, focusing on number theory, binary representation,
    and hexadecimal string characteristics.
    """

    def is_prime(n):
        """Helper function to check if a number is prime."""
        if n < 2:
            return False
        for i in range(2, int(math.sqrt(n)) + 1):
            if n % i == 0:
                return False
        return True

    def get_prime_factors_sum(n):
        """Helper function to calculate the sum of unique prime factors of n."""
        if n <= 1:
            return 0
        factors_sum = 0
        d = 2
        temp_n = n
        while d * d <= temp_n:
            if temp_n % d == 0:
                factors_sum += d
                while temp_n % d == 0: # Remove all occurrences of this prime factor
                    temp_n //= d
            d += 1
        if temp_n > 1: # If temp_n is still > 1, it's the last prime factor
            factors_sum += temp_n
        return factors_sum
        
    def is_powerful_number(n):
        """
        Helper function to check if a number is a "Powerful Number".
        A number n is powerful if for every prime factor p of n, p^2 also divides n.
        """
        if n <= 0:
            return False
        if n == 1:
            return True # By definition, 1 is a powerful number
        
        temp_n = n
        d = 2
        while d * d <= temp_n:
            if temp_n % d == 0:
                # d is a prime factor
                # Check if d^2 divides n
                if n % (d * d) != 0:
                    return False
                while temp_n % d == 0: # Remove all occurrences of this prime factor
                    temp_n //= d
            d += 1
        # If temp_n > 1, it's the last prime factor. We need to ensure that temp_n^2 divides the original n.
        if temp_n > 1:
            if n % (temp_n * temp_n) != 0:
                return False
        return True

    try:
        if isinstance(x, str):
            # String path: "Hexadecimal Sequence with Palindromic Properties"
            
            # Condition 1: Must be entirely lowercase hexadecimal digits (0-9, a-f).
            if not all(c in '0123456789abcdef' for c in x):
                return False
            
            # Condition 2: Length must be a prime number between 5 and 10 (inclusive).
            # Possible lengths: 5, 7.
            string_length = len(x)
            if not (5 <= string_length <= 10 and is_prime(string_length)):
                return False
            
            # Condition 3: The string must be a palindrome.
            if x != x[::-1]:
                return False
            
            # Helper for hexadecimal character to integer conversion
            hex_to_int = lambda c: int(c, 16)

            # Condition 4: The sum of the numerical values (0-15) of its digits
            # must be a prime number.
            numerical_sum = sum(hex_to_int(c) for c in x)
            if not is_prime(numerical_sum):
                return False
            
            # Condition 5: The numerical value of the central character
            # (which exists because length is odd) must be a prime number (0-15).
            # Primes in 0-15 are: 2, 3, 5, 7, 11, 13.
            central_char = x[string_length // 2]
            central_val = hex_to_int(central_char)
            if not is_prime(central_val):
                return False
            
            return True

        elif isinstance(x, int):
            # Integer path: "Binary-Powerful Number with Digit Constraints"
            
            # Condition 1: Must be a positive integer.
            if x <= 0:
                return False
            
            # Condition 2: Its binary representation must have a specific length (exactly 10 bits).
            # This means x must be in the range [2^9, 2^10 - 1], i.e., [512, 1023].
            if not (512 <= x <= 1023):
                return False
            
            # Condition 3: The number of '1's in its binary representation must be a prime number.
            binary_x = bin(x)[2:] # Remove '0b' prefix
            ones_count = binary_x.count('1')
            if not is_prime(ones_count): # Primes: 2, 3, 5, 7, ...
                return False
            
            # Condition 4: The integer must be a "Powerful Number".
            if not is_powerful_number(x):
                return False
            
            # Condition 5: The sum of its unique prime factors must be a two-digit prime number.
            # (e.g., 11, 13, 17, 19, ..., 97).
            unique_prime_factors_sum = get_prime_factors_sum(x)
            if not (10 <= unique_prime_factors_sum <= 99 and is_prime(unique_prime_factors_sum)):
                return False
            
            return True

        else:
            # If x is neither a string nor an integer, it returns False.
            return False
            
    except ValueError:
        # Handles cases like int("abc") or other conversion issues
        return False
    except OverflowError:
        # Handles cases with extremely large numbers
        return False
    except Exception:
        # Catch any other unexpected errors
        return False
"00200"
529
Proposer: gemini-2.5-flash Solver: gemini-3-pro-preview
-1 vs 1
#6 Solver Failed
def mystery(x):
    """
    This function validates a string based on structural patterns,
    character frequency, and numerical partitions.
    """
    if not isinstance(x, str):
        return False
    
    # 1. Basic Format Checks
    # The string must be exactly 10 lowercase English letters.
    if len(x) != 10 or not x.islower() or not x.isalpha():
        return False

    # 2. Alternating Pattern Constraint
    # The string must strictly alternate between vowels and consonants.
    # Vowels are defined as 'a', 'e', 'i', 'o', 'u'.
    vowels = set('aeiou')
    is_prev_vowel = x[0] in vowels
    
    for i in range(1, len(x)):
        is_curr_vowel = x[i] in vowels
        if is_prev_vowel == is_curr_vowel:
            return False
        is_prev_vowel = is_curr_vowel
        
    # 3. Frequency Constraint
    # No character can appear more than twice in the string.
    from collections import Counter
    counts = Counter(x)
    if any(c > 2 for c in counts.values()):
        return False
        
    # 4. Substring Constraint
    # The string must contain the substring "key".
    if "key" not in x:
        return False
        
    # 5. Numerical Partition Constraint
    # We map characters to values: a=0, b=1, ..., z=25.
    vals = [ord(c) - ord('a') for c in x]
    
    # Condition A: The sum of all values must be exactly 90.
    if sum(vals) != 90:
        return False
        
    # Condition B: The string is split into two halves (first 5 chars, last 5 chars).
    # The product of (value + 1) for the first half must equal 
    # the product of (value + 1) for the second half.
    prod1 = 1
    for v in vals[:5]:
        prod1 *= (v + 1)
        
    prod2 = 1
    for v in vals[5:]:
        prod2 *= (v + 1)
        
    if prod1 != prod2:
        return False
        
    return True
"koyebadigu"
"keyibeboko"
Proposer: gemini-3-pro-preview Solver: gemini-2.5-flash
-1 vs 2
#7 Solved
import math

def mystery(x):
    """
    This function evaluates inputs based on various numerical and string properties,
    including digit uniqueness, iterative sums, prime factors, and binary patterns.
    """

    def is_prime(n):
        """Helper function to check if a number is prime."""
        if n < 2:
            return False
        for i in range(2, int(math.sqrt(n)) + 1):
            if n % i == 0:
                return False
        return True

    def sum_digits(n):
        """Helper function to calculate the sum of digits of a number."""
        return sum(int(d) for d in str(abs(n)))

    def is_perfect_square(n):
        """Helper function to check if a number is a perfect square."""
        if n < 0:
            return False
        if n == 0: # 0 is a perfect square (0*0)
            return True
        sqrt_n = int(math.sqrt(n))
        return sqrt_n * sqrt_n == n

    def get_sum_of_digits_after_rev_add(n, iterations):
        """
        Helper function to perform reverse-and-add iterations
        and return the sum of digits of the final number.
        """
        current = n
        for _ in range(iterations):
            rev_current = int(str(current)[::-1])
            current += rev_current
        return sum_digits(current)

    try:
        if isinstance(x, str):
            # Condition 1: The string must consist purely of 6 digits.
            if not x.isdigit() or len(x) != 6:
                return False
            
            # Condition 2: All digits in the string must be unique.
            if len(set(x)) != 6:
                return False
            
            num_val = int(x)
            
            # Condition 3: The sum of digits of the number obtained after 3 "reverse-and-add"
            # iterations must be a prime number.
            # Example: 196 -> (196+691)=887 -> (887+788)=1675 -> (1675+5761)=7436. Sum digits(7436) = 20.
            if not is_prime(get_sum_of_digits_after_rev_add(num_val, 3)):
                return False
            
            # Condition 4: The sum of the numerical values of its digits must be a prime number.
            if not is_prime(sum_digits(num_val)):
                return False
            
            # Condition 5: The product of the numerical values of its digits must be a perfect cube.
            product_digits = 1
            for digit_char in x:
                product_digits *= int(digit_char)
            
            # A number n is a perfect cube if n^(1/3) is an integer. 0 is a perfect cube (0^3).
            if product_digits < 0: # Product of digits cannot be negative
                return False
            cbrt_prod = round(product_digits**(1/3))
            if cbrt_prod * cbrt_prod * cbrt_prod != product_digits:
                return False
            
            return True # All string conditions met

        elif isinstance(x, int):
            # Condition 1: The integer must be positive.
            if x <= 0:
                return False
            
            # Condition 2: The integer must be a 3-digit number.
            if not (100 <= x <= 999):
                return False
            
            # Condition 3: The integer must be a multiple of 7.
            if x % 7 != 0:
                return False
            
            # Condition 4: The sum of its digits must be an even number.
            if sum_digits(x) % 2 != 0:
                return False
            
            # Condition 5: The number of '1's in its binary representation must be exactly 4.
            binary_x = bin(x)[2:] # Remove '0b' prefix
            if binary_x.count('1') != 4:
                return False
            
            return True # All integer conditions met
            
        else:
            # If x is neither a string nor an integer, it returns False.
            return False
            
    except ValueError:
        # Handles cases where int(x) fails for a string (e.g., "abc")
        return False
    except OverflowError:
        # Handles cases with extremely large numbers that cause overflow
        return False
    except Exception:
        # Catch any other unexpected errors
        return False
105
"123056"
Proposer: gemini-2.5-flash Solver: gemini-3-pro-preview
-1 vs 2
#8 Solved
def mystery(x):
    """
    Validates a path string for an archaeological expedition simulation.
    The string represents a sequence of moves and actions on a 2D grid.
    """
    if not isinstance(x, str):
        return False

    # 1. Character Validation
    # Only cardinal directions and 'D' for Dig allowed.
    allowed = set('NEWSD')
    if not set(x).issubset(allowed):
        return False
        
    # 2. Keyword Check
    # The expedition string must contain the substring 'END'.
    if 'END' not in x:
        return False

    # 3. Checksum
    # The sum of ASCII values of the string must be a multiple of 71.
    if sum(ord(c) for c in x) % 71 != 0:
        return False

    # 4. Path Simulation
    # Start at (0,0). Track visited locations to prevent loops 
    # (except for returning to start at the very end).
    x_pos, y_pos = 0, 0
    visited = {(0, 0)}
    dig_sites = []
    
    moves = {
        'N': (0, 1), 'S': (0, -1), 
        'E': (1, 0), 'W': (-1, 0)
    }

    for i, char in enumerate(x):
        if char == 'D':
            # Dig at current location
            current_site = (x_pos, y_pos)
            dig_sites.append(current_site)
            # Cannot dig same spot twice
            if dig_sites.count(current_site) > 1:
                return False
        else:
            dx, dy = moves[char]
            x_pos += dx
            y_pos += dy
            
            new_pos = (x_pos, y_pos)
            
            # Crossing check:
            # Can only visit a spot if it's new, OR if it's the 
            # very last move returning to (0,0).
            if new_pos in visited:
                is_last_move = (i == len(x) - 1)
                if not (is_last_move and new_pos == (0, 0)):
                    return False
            
            visited.add(new_pos)

    # 5. Path Loop Check
    # Must end back at (0,0).
    if (x_pos, y_pos) != (0, 0):
        return False

    # 6. Excavation Count
    # Must dig exactly 3 times.
    if len(dig_sites) != 3:
        return False

    # 7. Geometry Check
    # The three dig sites must form a Right-Angled Triangle.
    p1, p2, p3 = dig_sites
    
    # Squared distances between points
    d1 = (p1[0]-p2[0])**2 + (p1[1]-p2[1])**2
    d2 = (p2[0]-p3[0])**2 + (p2[1]-p3[1])**2
    d3 = (p3[0]-p1[0])**2 + (p3[1]-p1[1])**2
    
    sides = sorted([d1, d2, d3])
    # Pythagorean theorem: a^2 + b^2 = c^2 (sides are already squared)
    if sides[0] + sides[1] != sides[2]:
        return False

    # 8. Area Check
    # The area of the triangle must be exactly 6.
    # Shoelace formula for area
    xs = [p[0] for p in dig_sites]
    ys = [p[1] for p in dig_sites]
    
    lhs = sum(xs[i] * ys[(i+1)%3] for i in range(3))
    rhs = sum(xs[(i+1)%3] * ys[i] for i in range(3))
    area = abs(lhs - rhs) / 2.0
    
    return area == 6.0
"ENDEEEDNNNNWWWDWSSSSS"
"ENDEEEDNNNNDWWWWSSSSS"
Proposer: gemini-3-pro-preview Solver: gemini-2.5-flash
-1 vs 2
#9 Sample Solution Wrong
import math

def mystery(x):
    """
    This function evaluates inputs based on a unique set of constraints
    for strings (character patterns, ASCII properties) and integers
    (number theory, binary representation).
    """

    def is_prime(n):
        """Helper function to check if a number is prime."""
        if n < 2:
            return False
        for i in range(2, int(math.sqrt(n)) + 1):
            if n % i == 0:
                return False
        return True

    def sum_digits(n):
        """Helper function to calculate the sum of digits of a number."""
        return sum(int(d) for d in str(abs(n)))

    def is_perfect_square(n):
        """Helper function to check if a number is a perfect square."""
        if n < 0:
            return False
        if n == 0:
            return True
        sqrt_n = int(math.sqrt(n))
        return sqrt_n * sqrt_n == n

    def get_distinct_prime_factors(n):
        """Helper function to get the set of distinct prime factors of n."""
        if n <= 1:
            return set()
        factors = set()
        d = 2
        temp_n = n
        while d * d <= temp_n:
            if temp_n % d == 0:
                factors.add(d)
                while temp_n % d == 0:
                    temp_n //= d
            d += 1
        if temp_n > 1:
            factors.add(temp_n)
        return factors
    
    def get_char_numerical_value(char):
        """Helper function to get a=1, b=2, ..., z=26."""
        if 'a' <= char <= 'z':
            return ord(char) - ord('a') + 1
        return -1 # Invalid character

    def is_vowel(char):
        """Helper function to check if a character is a vowel."""
        return char in 'aeiou'

    try:
        if isinstance(x, str):
            # String Path: "ASCII Sum & Pattern"
            
            # Condition 1: Length must be exactly 6 characters.
            if len(x) != 6:
                return False
            
            # Condition 2: All characters must be lowercase English letters.
            if not x.islower() or not x.isalpha():
                return False
            
            # Condition 3: The string must follow a strict CVCVCV (Consonant-Vowel-Consonant-Vowel-Consonant-Vowel) pattern.
            for i, char in enumerate(x):
                if i % 2 == 0: # Even index (0, 2, 4) should be a consonant
                    if is_vowel(char):
                        return False
                else: # Odd index (1, 3, 5) should be a vowel
                    if not is_vowel(char):
                        return False
            
            # Condition 4: All characters in the string must be unique.
            if len(set(x)) != 6:
                return False
            
            # Condition 5: The sum of the ASCII values of all characters must be between 600 and 650 (inclusive).
            ascii_sum = sum(ord(c) for c in x)
            if not (600 <= ascii_sum <= 650):
                return False
            
            # Condition 6: The sum of (numerical_value * (index + 1)) for all characters
            # must be a prime number. (a=1, b=2, ..., z=26)
            positional_numerical_sum = sum(get_char_numerical_value(c) * (i + 1) for i, c in enumerate(x))
            if not is_prime(positional_numerical_sum):
                return False
            
            return True

        elif isinstance(x, int):
            # Integer Path: "Number Property Chain"
            
            # Condition 1: Must be a 5-digit number (10000-99999).
            if not (10000 <= x <= 99999):
                return False
            
            # Condition 2: The sum of its digits (base 10) must be a perfect square.
            digit_sum_base10 = sum_digits(x)
            if not is_perfect_square(digit_sum_base10):
                return False
            
            # Condition 3: The sum of its distinct prime factors must be a prime number.
            distinct_prime_factors = get_distinct_prime_factors(x)
            sum_distinct_prime_factors = sum(distinct_prime_factors)
            if not is_prime(sum_distinct_prime_factors):
                return False
            
            # Condition 4: Its binary representation (without '0b' prefix) must be a palindrome.
            binary_x = bin(x)[2:]
            if not (binary_x == binary_x[::-1]):
                return False
            
            # Condition 5: The count of '1's in its binary representation must be a prime number.
            ones_count_binary = binary_x.count('1')
            if not is_prime(ones_count_binary):
                return False
            
            return True

        else:
            # If x is neither a string nor an integer, it returns False.
            return False
            
    except ValueError:
        # Handles cases like int("abc") or other conversion issues
        return False
    except OverflowError:
        # Handles cases with extremely large numbers
        return False
    except Exception:
        # Catch any other unexpected errors
        return False
17777
Proposer: gemini-2.5-flash Solver: gemini-3-pro-preview
-2 vs 2
#10 Solved
def mystery(x):
    """
    Analyzes a string representing a chemical-like formula to validate
    its structural, atomic, and numerical properties.
    """
    if not isinstance(x, str):
        return False
    
    # 1. Format Check
    # The string must be exactly 8 characters long.
    # It must follow the pattern: Element-Count-Element-Count...
    # (4 pairs of an Uppercase Letter followed by a Digit)
    if len(x) != 8:
        return False
        
    elements = x[0::2] # Indices 0, 2, 4, 6
    counts = x[1::2]   # Indices 1, 3, 5, 7
    
    if not elements.isalpha() or not elements.isupper():
        return False
    if not counts.isdigit() or '0' in counts: # Counts must be 1-9
        return False
        
    # 2. Structural Constraints
    # Must contain exactly 4 distinct elements.
    if len(set(elements)) != 4:
        return False
        
    # The formula must start with Carbon ('C') and the last element group must be Hydrogen ('H').
    if elements[0] != 'C' or elements[-1] != 'H':
        return False
        
    # 3. ASCII Resonance
    # The sum of the ASCII values of the 4 element symbols must be a perfect square.
    ascii_sum = sum(ord(e) for e in elements)
    if int(ascii_sum**0.5)**2 != ascii_sum:
        return False
        
    # 4. Atomic Mass Calculation
    # Uses standard integer atomic weights for a subset of elements.
    periodic_table = {
        'H': 1, 'C': 12, 'N': 14, 'O': 16, 
        'F': 19, 'P': 31, 'S': 32, 'K': 39
    }
    
    if not all(e in periodic_table for e in elements):
        return False
        
    total_weight = 0
    total_atoms = 0
    
    for i in range(4):
        el = elements[i]
        cnt = int(counts[i])
        total_weight += periodic_table[el] * cnt
        total_atoms += cnt
        
    # 5. Stability Checks
    # The calculated molecular weight must be a palindrome number.
    s_weight = str(total_weight)
    if s_weight != s_weight[::-1]:
        return False
        
    # The total number of atoms in the molecule must be a prime number.
    def is_prime(n):
        if n < 2: return False
        for i in range(2, int(n**0.5) + 1):
            if n % i == 0: return False
        return True
        
    if not is_prime(total_atoms):
        return False
        
    # 6. Quantum Link
    # The total atom count must be exactly 8 more than the sum of the digits of the molecular weight.
    weight_digit_sum = sum(int(d) for d in s_weight)
    
    return total_atoms == weight_digit_sum + 8
"C2F1P2H6"
"C2F4P8H5"
Proposer: gemini-3-pro-preview Solver: gemini-2.5-flash
-2 vs 2