← All Duels

gemini-2.5-pro_vs_deepseek-reasoner_20260124_140308.jsonl — 10 puzzles

gemini-2.5-pro
-4
vs
deepseek-reasoner
-3
#1 Solved
import math

def mystery(x):
    """
    Find a value x for which this function returns True.
    """
    # Constraint 1: Must be a string of a certain length.
    if not isinstance(x, str) or len(x) < 2:
        return False
    
    # Constraint 2: Must be a valid hexadecimal number.
    try:
        val = int(x, 16)
    except ValueError:
        return False

    # Constraint 3: The length of the string must be a prime number.
    n = len(x)
    if n > 1:
        for i in range(2, int(math.sqrt(n)) + 1):
            if n % i == 0:
                return False
    else:
        return False
            
    # Constraint 4: A specific property of the numerical value.
    s = val
    while s >= 10:
        s = sum(int(d) for d in str(s))
        
    return s == 1
"01"
"10003"
Proposer: gemini-2.5-pro Solver: deepseek-reasoner
0 vs 0
#2 Solved
import math

def mystery(x):
    """
    Find a value x (string of digits) for which this function returns True.
    """
    # Must be a non-empty string of digits
    if not isinstance(x, str) or not x.isdigit():
        return False
    
    n = int(x)
    if n <= 1:
        return False
    
    # Condition 1: n ≡ 1 (mod 8)
    if n % 8 != 1:
        return False
    
    # Condition 2: n is divisible by the sum of its digits
    digit_sum = sum(int(d) for d in x)
    if digit_sum == 0 or n % digit_sum != 0:
        return False
    
    # Condition 3: n is not divisible by 5
    if n % 5 == 0:
        return False
    
    # Helper: primality test
    def is_prime(p):
        if p < 2:
            return False
        if p % 2 == 0:
            return p == 2
        for d in range(3, int(math.sqrt(p)) + 1, 2):
            if p % d == 0:
                return False
        return True
    
    # Helper: Carmichael test (Korselt criterion)
    def is_carmichael(num):
        if is_prime(num):
            return False
        # factorize by trial division
        factors = set()
        temp = num
        for d in range(2, int(math.sqrt(temp)) + 1):
            while temp % d == 0:
                factors.add(d)
                temp //= d
        if temp > 1:
            factors.add(temp)
        # Check squarefree and each p-1 divides num-1
        for p in factors:
            if not is_prime(p):
                return False
            if (num - 1) % (p - 1) != 0:
                return False
        return True
    
    if not is_carmichael(n):
        return False
    
    # Condition 4: n is a taxicab number (at least two distinct representations as sum of two positive cubes)
    def is_taxicab(num):
        limit = int(round(num ** (1/3))) + 1
        pairs = []
        for i in range(1, limit):
            i3 = i * i * i
            if i3 > num:
                break
            for j in range(i + 1, limit):
                j3 = j * j * j
                s = i3 + j3
                if s > num:
                    break
                if s == num:
                    pairs.append((i, j))
                    if len(pairs) >= 2:
                        return True
        return False
    
    if not is_taxicab(n):
        return False
    
    return True
"1729"
"1729"
Proposer: deepseek-reasoner Solver: gemini-2.5-pro
0 vs 0
#3 Sample Solution Wrong
import hashlib

def mystery(x):
    """
    Find a value x for which this function returns True.
    """
    # C1: Input must be a string and have a specific format.
    if not isinstance(x, str) or ':' not in x:
        return False
        
    try:
        f_string, nonce_str = x.rsplit(':', 1)
        # The first part must look like it's intended for string formatting.
        if '{' not in f_string or '}' not in f_string:
            return False
        nonce = int(nonce_str)
    except (ValueError, IndexError):
        return False
        
    # C2: The f-string part, when formatted with the nonce, creates the body.
    try:
        body = f_string.format(nonce)
    except (ValueError, IndexError):
        # Handles cases like "{} and {}" with a single nonce, which are invalid for this puzzle.
        return False

    # C3: A cryptographic hash of the body is computed.
    h = hashlib.sha1(body.encode()).digest()
    
    # C4: A number is derived from the tail of the hash digest.
    # The digest must be long enough.
    if len(h) < 2:
        return False
    
    val_from_hash = int.from_bytes(h[-2:], 'big')
    
    # C5: The derived number must have a special relationship with the nonce.
    return val_from_hash == nonce
"A solution to this puzzle is the number {} itself:49463"
Proposer: gemini-2.5-pro Solver: deepseek-reasoner
-1 vs 0
#4 Sample Solution Wrong
import math

def mystery(x):
    # Returns True only for a very special number x.
    if not isinstance(x, str):
        return False
    if not x.isdigit():
        return False
    if len(x) < 2:
        return False
    n = int(x)
    # Helper: primality test
    def is_prime(p):
        if p < 2:
            return False
        if p % 2 == 0:
            return p == 2
        for d in range(3, int(math.sqrt(p)) + 1, 2):
            if p % d == 0:
                return False
        return True
    # Helper: happy number test
    def is_happy(num):
        seen = set()
        while num != 1 and num not in seen:
            seen.add(num)
            num = sum(int(d)**2 for d in str(num))
        return num == 1
    # Helper: perfect square test
    def is_square(m):
        if m < 0:
            return False
        r = int(math.sqrt(m))
        return r*r == m
    # 1. Prime
    if not is_prime(n):
        return False
    # 2. Palindromic
    if x != x[::-1]:
        return False
    # 3. Circular prime
    s = x
    for i in range(len(s)):
        rot = int(s[i:] + s[:i])
        if not is_prime(rot):
            return False
    # 4. Truncatable prime (both left and right)
    for i in range(1, len(s)):
        if not is_prime(int(s[i:])):   # left-truncation
            return False
        if not is_prime(int(s[:-i])):  # right-truncation
            return False
    # 5. Happy prime
    if not is_happy(n):
        return False
    # 6. Sum of digits is prime
    digit_sum = sum(int(d) for d in x)
    if not is_prime(digit_sum):
        return False
    # 7. Product of digits is a perfect square
    digit_prod = 1
    for d in x:
        digit_prod *= int(d)
    if not is_square(digit_prod):
        return False
    # 8. Pythagorean prime: n ≡ 1 (mod 4)
    if n % 4 != 1:
        return False
    # 9. Centered square number: exists k such that n = k^2 + (k+1)^2
    disc = 4 * (2*n - 1)
    sqrt_disc = int(math.isqrt(disc))
    if sqrt_disc * sqrt_disc != disc:
        return False
    k = (-2 + sqrt_disc) // 4
    if k <= 0:
        return False
    if n != k*k + (k+1)*(k+1):
        return False
    return True
313
Proposer: deepseek-reasoner Solver: gemini-2.5-pro
-1 vs -1
#5 Sample Solution Wrong
import struct
import math

def mystery(x):
    """
    Find a value x for which this function returns True.
    """
    # C1: Input must be a string of a specific length and format.
    if not isinstance(x, str) or len(x) != 12 or '.' not in x:
        return False
    
    parts = x.split('.')
    if len(parts) != 2:
        return False
    
    a_str, b_str = parts
    if not a_str.isdigit() or not b_str.isdigit() or not a_str or not b_str:
        return False

    a = int(a_str)
    b = int(b_str)

    # C2: The two integer parts must satisfy a linear Diophantine equation.
    if 3 * a - 5 * b != 1:
        return False

    # C3: Convert to float and get its 64-bit integer representation (IEEE 754).
    try:
        f = float(x)
        # Get the 8-byte (64-bit) representation in big-endian format.
        packed = struct.pack('>d', f)
        # Interpret these 8 bytes as a single 64-bit unsigned integer.
        i = int.from_bytes(packed, 'big')
    except (ValueError, OverflowError):
        return False

    # C4: The number of set bits (popcount) in this integer representation...
    popcount = bin(i).count('1')

    # ...must be a prime number.
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        for i in range(3, int(math.sqrt(n)) + 1, 2):
            if n % i == 0:
                return False
        return True

    return is_prime(popcount)
'100012.60007'
Proposer: gemini-2.5-pro Solver: deepseek-reasoner
-2 vs -1
#6 Solved
import math

def mystery(x):
    # Returns True only for a very special number x.
    if not isinstance(x, str):
        return False
    if not x.isdigit():
        return False
    if len(x) < 3:
        return False
    n = int(x)
    if n <= 100:
        return False
    
    def is_prime(p):
        if p < 2:
            return False
        if p == 2:
            return True
        if p % 2 == 0:
            return False
        for i in range(3, int(math.sqrt(p)) + 1, 2):
            if p % i == 0:
                return False
        return True
    
    def is_happy(num):
        seen = set()
        while num != 1 and num not in seen:
            seen.add(num)
            num = sum(int(d)**2 for d in str(num))
        return num == 1
    
    if not is_prime(n):
        return False
    
    if x != x[::-1]:
        return False
    
    binary = bin(n)[2:]
    if binary != binary[::-1]:
        return False
    
    if not is_happy(n):
        return False
    
    digit_sum = sum(int(d) for d in x)
    if not is_prime(digit_sum):
        return False
    
    digit_prod = 1
    for d in x:
        digit_prod *= int(d)
    if digit_prod <= 0:
        return False
    root = int(math.sqrt(digit_prod))
    if root * root != digit_prod:
        return False
    
    if n % 4 != 1:
        return False
    
    val = 2 * n - 1
    sqrt_val = int(math.isqrt(val))
    if sqrt_val * sqrt_val != val:
        return False
    k = ( -1 + sqrt_val ) // 2
    if k <= 0:
        return False
    if n != k*k + (k+1)*(k+1):
        return False
    
    return True
"313"
"313"
Proposer: deepseek-reasoner Solver: gemini-2.5-pro
-2 vs -1
#7 Sample Solution Wrong
import re

def mystery(x):
    """
    Find a value x for which this function returns True.
    """
    # C1: The input must be a string representation of an integer.
    if not isinstance(x, str) or not x.isdigit():
        return False
    
    try:
        s = int(x)
    except ValueError:
        return False
    
    # C2: The puzzle uses a hardcoded RSA public key (n, e).
    # n is the modulus, e is the public exponent.
    n = 933333333333333333333333332158888888888888888888888888888887
    e = 65537
    
    # The input 's' is treated as a signature. We verify it by computing
    # message = s^e mod n.
    m = pow(s, e, n)
    
    # C3: The decrypted message 'm' must be a valid UTF-8 string
    # that conforms to a specific poetic structure (a haiku).
    try:
        # Calculate the number of bytes needed to represent m.
        # An empty message (m=0) is invalid.
        if m == 0:
            return False
        byte_length = (m.bit_length() + 7) // 8
        message_bytes = m.to_bytes(byte_length, 'big')
        message_text = message_bytes.decode('utf-8')
    except (UnicodeDecodeError, OverflowError):
        return False

    def is_haiku(text):
        """
        A helper function to check if a text is a 5-7-5 haiku.
        Uses a simple heuristic for syllable counting.
        """
        def count_syllables(line):
            line = line.lower().strip()
            line = re.sub(r'[^a-z\s]', '', line) # Keep only letters and spaces
            if not line:
                return 0
            
            words = line.split()
            total_syllables = 0
            
            for word in words:
                if len(word) <= 3:
                    syllable_count = 1
                else:
                    # remove silent 'e' at the end, unless it's like 'le'
                    if word.endswith('e') and not word.endswith('le'):
                        word = word[:-1]
                    # count vowel groups
                    vowel_groups = re.findall(r'[aeiouy]+', word)
                    syllable_count = len(vowel_groups)

                total_syllables += max(1, syllable_count) # each word has at least one syllable
            
            return total_syllables

        lines = text.strip().split('\n')
        if len(lines) != 3:
            return False
        
        syllables_per_line = [count_syllables(line) for line in lines]
        return syllables_per_line == [5, 7, 5]

    return is_haiku(message_text)
'619551322234473215237300501822131081123482748380203025091836'`
Proposer: gemini-2.5-pro Solver: deepseek-reasoner
-3 vs -1
#8 Sample Solution Wrong
import math

def mystery(x):
    """
    Find a value x for which this function returns True.
    """
    if not isinstance(x, str):
        return False
    x = x.strip()
    try:
        val = float(x)
    except ValueError:
        return False
    if val <= 1:
        return False
    # Check golden ratio equation: val^2 == val + 1
    return abs(val*val - val - 1) < 1e-14
1.618033988749895
Proposer: deepseek-reasoner Solver: gemini-2.5-pro
-3 vs -2
#9 Sample Solution Wrong
import hashlib

def mystery(x):
    """
    Find a value x for which this function returns True.
    The secret lies not in the code you see, but the map it implies.
    """
    # C1: Input must be a string composed of 'U', 'D', 'L', 'R'.
    if not isinstance(x, str) or any(c not in 'UDLR' for c in x):
        return False

    # The maze is procedurally generated but deterministic. Its structure
    # is derived from a seed, which is subtly hidden within this function.
    maze_seed = mystery.__doc__

    def is_wall(r1, c1, r2, c2):
        """Determines if a wall exists between two adjacent cells."""
        # Create a canonical representation of the wall's location
        # to ensure is_wall(p1, p2) == is_wall(p2, p1).
        if (r1, c1) > (r2, c2):
            r1, c1, r2, c2 = r2, c2, r1, c1
        
        h = hashlib.sha256()
        h.update(maze_seed.encode())
        h.update(f"wall:({r1},{c1})-({r2},{c2})".encode())
        # A wall exists if the first byte of the hash is below a threshold.
        # This creates a pseudo-random but fixed maze layout.
        return h.digest()[0] < 100

    # Maze parameters
    SIZE = 16
    START = (0, 0)
    END = (SIZE - 1, SIZE - 1)
    
    pos = list(START)
    
    # C2: The input string `x` must represent a valid path from START to END.
    for move in x:
        r, c = pos
        
        # Determine the next position based on the move.
        next_r, next_c = r, c
        if move == 'U': next_r -= 1
        elif move == 'D': next_r += 1
        elif move == 'L': next_c -= 1
        elif move == 'R': next_c += 1
        
        # Check for boundary violations.
        if not (0 <= next_r < SIZE and 0 <= next_c < SIZE):
            return False
        
        # Check if the path is blocked by a wall.
        if is_wall(r, c, next_r, next_c):
            return False
        
        # Update position.
        pos = [next_r, next_c]
            
    # C3: The path must end at the correct destination.
    return tuple(pos) == END
"RRRDRDRDRDDLDDRDRDRURDRDRDRDRDRDDLDDRDRURUULURDRDRDRD"
Proposer: gemini-2.5-pro Solver: deepseek-reasoner
-4 vs -2
#10 Sample Solution Wrong
import math

def mystery(x):
    """
    Find a value x for which this function returns True.
    """
    # Must be a non-empty string of digits, no leading zero
    if not isinstance(x, str) or not x.isdigit():
        return False
    if len(x) > 1 and x[0] == '0':
        return False
    
    n = int(x)
    
    # Helper: primality test
    def is_prime(p):
        if p < 2:
            return False
        if p == 2:
            return True
        if p % 2 == 0:
            return False
        for i in range(3, int(math.sqrt(p)) + 1, 2):
            if p % i == 0:
                return False
        return True
    
    # 1. n must be prime
    if not is_prime(n):
        return False
    
    # 2. x must be palindromic
    if x != x[::-1]:
        return False
    
    # 3. n must be a Fibonacci number
    def is_fibonacci(num):
        s1 = 5*num*num + 4
        s2 = 5*num*num - 4
        return int(math.isqrt(s1))**2 == s1 or int(math.isqrt(s2))**2 == s2
    
    if not is_fibonacci(n):
        return False
    
    # 4. n must be a Wilson prime: (n-1)! ≡ -1 (mod n^2)
    def is_wilson(p):
        if p < 2:
            return False
        fact = 1
        for i in range(1, p):
            fact = (fact * i) % (p*p)
        return fact == (p*p - 1) % (p*p)
    
    if not is_wilson(n):
        return False
    
    # 5. n must be a safe prime: (p-1)/2 is also prime
    def is_safe(p):
        q = (p-1)//2
        return is_prime(q)
    
    if not is_safe(n):
        return False
    
    # 6. n must be a Chen prime: p+2 is either prime or a product of two primes
    def is_chen(p):
        r = p + 2
        if is_prime(r):
            return True
        temp = r
        factors = 0
        d = 2
        while d*d <= temp:
            while temp % d == 0:
                factors += 1
                temp //= d
            d += 1 if d == 2 else 2
        if temp > 1:
            factors += 1
        return factors == 2
    
    if not is_chen(n):
        return False
    
    # 7. n ≡ 1 (mod 4)
    if n % 4 != 1:
        return False
    
    # 8. n must be a centered square number: n = k^2 + (k+1)^2 for some k
    def is_centered_square(num):
        disc = 8*num - 4
        sqrt_disc = int(math.isqrt(disc))
        if sqrt_disc * sqrt_disc != disc:
            return False
        k = (-2 + sqrt_disc) // 4
        if k <= 0:
            return False
        return num == k*k + (k+1)*(k+1)
    
    if not is_centered_square(n):
        return False
    
    # 9. n must be the hypotenuse of a primitive Pythagorean triple
    def is_hypotenuse_primitive(h):
        h_sq = h*h
        limit = int(math.isqrt(h_sq))
        for a in range(1, limit):
            a_sq = a*a
            b_sq = h_sq - a_sq
            if b_sq < a_sq:
                break
            b = int(math.isqrt(b_sq))
            if b*b == b_sq and math.gcd(a, b) == 1:
                return True
        return False
    
    if not is_hypotenuse_primitive(n):
        return False
    
    # 10. Sum of digits of x is prime
    digit_sum = sum(int(d) for d in x)
    if not is_prime(digit_sum):
        return False
    
    # 11. Product of digits of x is a Fibonacci number
    digit_prod = 1
    for d in x:
        digit_prod *= int(d)
    if not is_fibonacci(digit_prod):
        return False
    
    return True
5
Proposer: deepseek-reasoner Solver: gemini-2.5-pro
-4 vs -3