← All Duels

claude-sonnet-4-5-20250929_vs_gemini-2.5-pro_20260124_003328.jsonl — 10 puzzles

claude-sonnet-4-5-20250929
0
vs
gemini-2.5-pro
-5
#1 Solved
def mystery(x):
    if not isinstance(x, int):
        return False
    if x < 100 or x > 999:
        return False
    
    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(x):
        return False
    
    digit_sum = sum(int(d) for d in str(x))
    if not is_prime(digit_sum):
        return False
    
    reversed_x = int(str(x)[::-1])
    if not is_prime(reversed_x):
        return False
    
    return True
101
113
Proposer: claude-sonnet-4-5-20250929 Solver: gemini-2.5-pro
0 vs 0
#2 Sample Solution Wrong
import hashlib

def mystery(x):
    # The input must be a string representation of a number.
    if not isinstance(x, str) or not x.isdecimal():
        return False

    # The number must be of a certain magnitude.
    if not (5 <= len(x) <= 8):
        return False
    
    val = int(x)

    # A lower bound to narrow the search space slightly.
    if val < 65536: # 2**16
        return False

    # The first major condition: a relationship between the number and its own hash.
    # This requires finding a partial hash collision.
    h = hashlib.sha256(x.encode()).hexdigest()
    if not h.endswith(x[-4:]):
        return False
        
    # The second major condition: an obscure property of the number's binary representation.
    # The numbers in this set are not obviously related without inspection.
    magic_set = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}
    if bin(val).count('1') not in magic_set:
        return False

    return True
"345043"
Proposer: gemini-2.5-pro Solver: claude-sonnet-4-5-20250929
0 vs -1
#3 Solved
def mystery(x):
    if not isinstance(x, str):
        return False
    
    if len(x) < 5 or len(x) > 10:
        return False
    
    # Must contain only lowercase letters and digits
    if not all(c.islower() or c.isdigit() for c in x):
        return False
    
    # Condition 1: Palindrome
    if x != x[::-1]:
        return False
    
    # Condition 2: Contains at least one digit and at least one letter
    if not any(c.isdigit() for c in x):
        return False
    if not any(c.isalpha() for c in x):
        return False
    
    # Condition 3: Sum of digit values equals number of letter characters
    digit_sum = sum(int(c) for c in x if c.isdigit())
    letter_count = sum(1 for c in x if c.isalpha())
    if digit_sum != letter_count:
        return False
    
    # Condition 4: The string must contain at least 2 distinct letters
    distinct_letters = len(set(c for c in x if c.isalpha()))
    if distinct_letters < 2:
        return False
    
    return True
"ab4ba"
"ab4ba"
Proposer: claude-sonnet-4-5-20250929 Solver: gemini-2.5-pro
0 vs -1
#4 Sample Solution Wrong
import struct
import hashlib
import math

def mystery(x):
    # The input must be a string that can be parsed as a floating point number.
    try:
        val = float(x)
    except (ValueError, TypeError):
        return False
    
    # The value must lie within a specific, narrow range.
    if not (0.1 < val < 0.2):
        return False
        
    # Condition 1: An arcane property related to the number's binary representation.
    # We consider the 64-bit IEEE 754 representation of the float.
    try:
        packed = struct.pack('!d', val)
        int_rep = struct.unpack('!Q', packed)[0]
    except (struct.error, OverflowError):
        # This might happen for special values like NaN or infinity.
        return False
    
    # This integer representation must be a perfect square.
    sqrt_int_rep = math.isqrt(int_rep)
    if sqrt_int_rep * sqrt_int_rep != int_rep:
        return False
        
    # Condition 2: A cryptographic link between the original string and its binary form.
    h = hashlib.md5(x.encode()).hexdigest()
    
    # The number of set bits ('1's) in the binary integer representation is significant.
    popcount = bin(int_rep).count('1')
    
    # A substring of the hash must match a property of the popcount.
    if hex(popcount)[2:] not in h:
        return False
        
    return True
'0.1492089456382181'
Proposer: gemini-2.5-pro Solver: claude-sonnet-4-5-20250929
0 vs -2
#5 Solved
def mystery(x):
    if not isinstance(x, int):
        return False
    
    if x < 1000 or x > 9999:
        return False
    
    s = str(x)
    
    # Condition 1: all digits must be non-zero and even
    for d in s:
        if int(d) == 0 or int(d) % 2 != 0:
            return False
    
    # Condition 2: product of first two digits equals product of last two digits
    prod_first = int(s[0]) * int(s[1])
    prod_last = int(s[2]) * int(s[3])
    if prod_first != prod_last:
        return False
    
    # Condition 3: sum of all digits must be divisible by 6
    digit_sum = sum(int(d) for d in s)
    if digit_sum % 6 != 0:
        return False
    
    # Condition 4: the number must be divisible by 11
    if x % 11 != 0:
        return False
    
    return True
2442
2442
Proposer: claude-sonnet-4-5-20250929 Solver: gemini-2.5-pro
0 vs -2
#6 Sample Solution Wrong
import math

def mystery(x):
    # The input must be an integer.
    if not isinstance(x, int):
        return False
    
    # Condition 1: The number must be within a specific range.
    if not (1_000_000 < x < 100_000_000):
        return False

    # Condition 2: The number must be a Fibonacci number.
    # This is tested using the property that for a number n > 0,
    # either 5*n^2 + 4 or 5*n^2 - 4 must be a perfect square.
    def is_perfect_square(n):
        if n < 0: return False
        if n == 0: return True
        s = math.isqrt(n)
        return s * s == n

    if not (is_perfect_square(5 * x * x + 4) or is_perfect_square(5 * x * x - 4)):
        return False

    # Condition 3: The number must be a semiprime.
    # A semiprime is a product of exactly two prime numbers (p*q), not necessarily distinct.
    # To check this, we find the smallest prime factor, p. Then we check if x/p is also prime.
    
    limit = math.isqrt(x)
    p = 0
    
    # Find the smallest factor p. Since it's the smallest, it must be prime.
    if x % 2 == 0:
        p = 2
    else:
        # Check odd factors up to sqrt(x)
        for i in range(3, limit + 1, 2):
            if x % i == 0:
                p = i
                break
    
    # If no factor is found up to sqrt(x), then x itself is prime.
    # A prime number is not a semiprime, so we return False.
    if p == 0:
        return False
        
    q = x // p
    
    # If x = p*p*p..., the smallest factor p is found, but q = x/p is not prime.
    # We must confirm q is prime.
    
    # Primality test for q
    if q < 2:
        return False
    if q == 2:
        # q is prime. The check is complete.
        return True
    if q % 2 == 0:
        # q is not prime (and not 2)
        return False
    
    q_limit = math.isqrt(q)
    for i in range(3, q_limit + 1, 2):
        if q % i == 0:
            # q has a factor, so it's not prime.
            return False
    
    # If we've reached here, q is prime.
    # So x = p * q, where p is the smallest prime factor and q is also prime.
    # This means x is a semiprime.
    return True
2178309
Proposer: gemini-2.5-pro Solver: claude-sonnet-4-5-20250929
0 vs -3
#7 Solved
def mystery(x):
    if not isinstance(x, str):
        return False
    
    # Must be exactly 7 characters
    if len(x) != 7:
        return False
    
    # Must be all lowercase letters
    if not x.islower() or not x.isalpha():
        return False
    
    # Condition 1: Must contain exactly 3 distinct letters
    if len(set(x)) != 3:
        return False
    
    # Condition 2: Each distinct letter must appear at least twice
    from collections import Counter
    counts = Counter(x)
    if any(count < 2 for count in counts.values()):
        return False
    
    # Condition 3: First and last characters must be the same
    if x[0] != x[-1]:
        return False
    
    # Condition 4: The string must be a palindrome
    if x != x[::-1]:
        return False
    
    return True
"abcacba"
"abcacba"
Proposer: claude-sonnet-4-5-20250929 Solver: gemini-2.5-pro
0 vs -3
#8 Sample Solution Wrong
def mystery(x):
    # --- Input Validation ---
    if not isinstance(x, str):
        return False
    if not all(c in 'NESW' for c in x):
        return False
    # Path length constraint. This is the length of the shortest path.
    if len(x) != 48:
        return False
        
    # --- Checksum Constraint ---
    # The sum of ASCII values of the path characters must match a target.
    # This uniquely identifies the correct path among multiple shortest paths.
    checksum = sum(ord(c) for c in x)
    if checksum != 3644:
        return False

    # --- Path Traversal Simulation ---
    r, c = 0, 0
    start_pos = (0, 0)
    end_pos = (15, 15)
    
    # The maze's wall generation logic.
    def _is_wall(r1, c1, r2, c2):
        # Check for out-of-bounds moves.
        if r1 < 0 or r1 > 15 or c1 < 0 or c1 > 15 or \
           r2 < 0 or r2 > 15 or c2 < 0 or c2 > 15:
            return True 
            
        # Ensure symmetry by ordering coordinates.
        if r1 > r2: r1, r2 = r2, r1
        if c1 > c2: c1, c2 = c2, c1
        
        # A pseudo-random but deterministic function based on coordinates.
        if r1 == r2: # Horizontal wall check
            seed = r1 * 101 + c1 * 103
        else: # Vertical wall check
            seed = r1 * 107 + c1 * 113
            
        # Use a large prime multiplier for better pseudo-randomness.
        val = (seed * 2654435761) & 0xFFFFFFFF
        # A 35% chance of a wall between any two adjacent cells.
        return (val % 100) < 35

    for move in x:
        nr, nc = r, c
        if move == 'N': nr -= 1
        elif move == 'S': nr += 1
        elif move == 'W': nc -= 1
        elif move == 'E': nc += 1
        
        if _is_wall(r, c, nr, nc):
            return False # The path is invalid if it hits a wall.
            
        r, c = nr, nc
        
    # --- Goal Check ---
    # The path must start at (0,0) and end at the target location (15, 15).
    return (r, c) == end_pos
"EESESSESESSEENEEESESSSEESSEENNEESSEESSEENNEENN"
Proposer: gemini-2.5-pro Solver: claude-sonnet-4-5-20250929
0 vs -4
#9 Solved
def mystery(x):
    if not isinstance(x, str):
        return False
    
    if len(x) != 8:
        return False
    
    # Must contain only lowercase letters
    if not x.islower() or not x.isalpha():
        return False
    
    # Condition 1: Must contain exactly 4 distinct letters
    if len(set(x)) != 4:
        return False
    
    # Condition 2: Each distinct letter must appear exactly twice
    from collections import Counter
    counts = Counter(x)
    if any(count != 2 for count in counts.values()):
        return False
    
    # Condition 3: No two adjacent characters can be the same
    for i in range(len(x) - 1):
        if x[i] == x[i+1]:
            return False
    
    # Condition 4: The letters at even positions (0,2,4,6) must all be different
    if len(set([x[0], x[2], x[4], x[6]])) != 4:
        return False
    
    # Condition 5: First letter must come before last letter alphabetically
    if x[0] >= x[-1]:
        return False
    
    return True
"acbdcadb"
"adbacbdc"
Proposer: claude-sonnet-4-5-20250929 Solver: gemini-2.5-pro
0 vs -4
#10 Sample Solution Wrong
import math

def mystery(x):
    # --- Input Validation ---
    if not isinstance(x, str) or len(x) != 20:
        return False
    if not all(c in '01' for c in x):
        return False

    # --- Condition 1: A Number Theoretic Property ---
    # The integer representation of the binary string must be a prime number.
    try:
        val = int(x, 2)
    except ValueError:
        return False
        
    def is_prime(n):
        if n < 2: return False
        if n == 2: return True
        if n % 2 == 0: return False
        limit = math.isqrt(n)
        for i in range(3, limit + 1, 2):
            if n % i == 0:
                return False
        return True
    
    if not is_prime(val):
        return False

    # --- Condition 2: An Iterative Transformation ---
    # The input string is treated as an initial state that evolves over time.
    # It must evolve into a specific target state after a fixed number of steps.
    
    # The update rule for the transformation.
    def _update_rule(l, c, r):
        # (left OR center) XOR right
        return (l | c) ^ r

    num_steps = 10
    length = 20
    state = [int(c) for c in x]

    for _ in range(num_steps):
        next_state = [0] * length
        for i in range(length):
            # The state array wraps around (periodic boundary conditions)
            left = state[(i - 1 + length) % length]
            center = state[i]
            right = state[(i + 1) + length) % length]
            
            next_state[i] = _update_rule(left, center, right)
        state = next_state
    
    final_state_str = "".join(map(str, state))
    
    target_state = '10101010101010101010'
    
    return final_state_str == target_state
'10000101001101001011'
Proposer: gemini-2.5-pro Solver: claude-sonnet-4-5-20250929
0 vs -5