import hashlib
import re
def mystery(x):
s = str(x)
# Input must look like a small "flag-like" token
if not re.fullmatch(r"[A-Za-z0-9_]{6,14}", s):
return False
# Deterministic gate based on the SHA-256 of the input
h = hashlib.sha256(s.encode("utf-8")).hexdigest()
# Condition: digest contains an uncommon-looking motif, and also begins with a fixed prefix
return h.startswith("00000") and ("c0ffee" in h)
import math
def mystery(x):
# x must be a positive integer
if not isinstance(x, int) or x <= 0:
return False
# Condition 1: x is a perfect square
root = int(math.isqrt(x))
if root * root != x:
return False
s = str(x)
# Condition 2: x has an odd number of digits
if len(s) % 2 == 0:
return False
# Condition 3: the middle digit is '7'
mid = len(s) // 2
if s[mid] != '7':
return False
# Condition 4: the sum of digits is prime
sod = sum(int(d) for d in s)
if sod < 2:
return False
for i in range(2, int(math.isqrt(sod)) + 1):
if sod % i == 0:
return False
# Condition 5: the reverse of x is also a perfect square
rev = int(s[::-1])
rev_root = int(math.isqrt(rev))
if rev_root * rev_root != rev:
return False
return True
import hashlib
import re
def mystery(x):
s = str(x)
# Must look like a small "token": 12 lowercase hex chars
if not re.fullmatch(r"[0-9a-f]{12}", s):
return False
b = bytes.fromhex(s) # exactly 6 bytes
# A few misleading arithmetic/bit constraints (still fairly permissive)
if (sum(b) ^ (b[0] << 1) ^ (b[5] << 2)) & 0xFF != 0xA6:
return False
if (b[1] + 3*b[2] + 5*b[3] + 7*b[4]) % 11 != 7:
return False
if (b[0] ^ b[2] ^ b[4]) != 0x59:
return False
# Main gate: SHA-256 preimage-ish condition on a structured message.
# Message includes a constant prefix + the 6 raw bytes + constant suffix.
msg = b"mystery:" + b + b":v1"
h = hashlib.sha256(msg).digest()
# Condition: digest starts with 20 zero bits and ends with specific 16-bit pattern.
return (h[0] == 0 and h[1] == 0 and (h[2] & 0xF0) == 0) and (h[-2:] == b"\x13\x37")
import math
def is_prime(n):
if n < 2:
return False
for i in range(2, int(math.isqrt(n)) + 1):
if n % i == 0:
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if not x.isalnum():
return False
n = len(x)
if not is_prime(n):
return False
if "puzzle" not in x.lower():
return False
digits = sum(c.isdigit() for c in x)
upper = sum(c.isupper() for c in x)
lower = sum(c.islower() for c in x)
if digits != 5:
return False
if upper == 0 or lower == 0:
return False
s = sum(ord(c) for c in x)
root = int(math.isqrt(s))
if root * root != s:
return False
return True
import hashlib
import re
def mystery(x):
s = str(x)
# Format gate: 16 chars, base32-ish, with a dash in the middle
# Example shape: ABCD3-EFGH7-JKLM2-NPQR5 (but without spaces)
if not re.fullmatch(r"[A-Z2-7]{4}(?:-[A-Z2-7]{4}){3}", s):
return False
# Normalize into raw 16 base32 symbols (remove dashes)
t = s.replace("-", "")
# "Decode" base32 symbols into 5-bit values (RFC 4648 alphabet, without '=')
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
vals = [alphabet.index(c) for c in t] # length 16, each 0..31
# Lightweight, misleading constraints (look structured but still leave some wiggle room)
if (sum(vals) % 7) != 0:
return False
if (vals[0] ^ vals[5] ^ vals[10] ^ vals[15]) != 17:
return False
if ((vals[3] + 2*vals[7] + 3*vals[11]) % 32) != 9:
return False
# Main gate: keyed-looking hash check (but key is embedded here)
# Use a double hash to make it look "hard" while remaining deterministic.
msg = ("v2|" + s + "|k=Z3").encode("utf-8")
h = hashlib.sha256(hashlib.sha256(msg).digest()).digest()
# Condition: 18 leading zero bits (hard to brute by hand) AND a specific 12-bit trailer pattern.
# Also require that the middle byte has a particular popcount.
lead_ok = (h[0] == 0 and h[1] == 0 and (h[2] & 0xC0) == 0)
tail_ok = ((h[-2] << 8 | h[-1]) & 0x0FFF) == 0xA5C
pop_ok = bin(h[len(h)//2]).count("1") == 4
return lead_ok and tail_ok and pop_ok
import math
def mystery(x):
if not isinstance(x, int):
return False
if x < 1000 or x > 9999:
return False
# perfect square
r = int(math.isqrt(x))
if r * r != x:
return False
# sum of digits even
s = sum(int(d) for d in str(x))
if s % 2 != 0:
return False
# first two digits form a perfect square
first2 = x // 100
if int(math.isqrt(first2)) ** 2 != first2:
return False
# last two digits form a perfect square
last2 = x % 100
if int(math.isqrt(last2)) ** 2 != last2:
return False
# square root is prime
if r < 2:
return False
for i in range(2, int(math.isqrt(r)) + 1):
if r % i == 0:
return False
return True
import hashlib
import re
def mystery(x):
s = str(x)
# Tight-looking "token" format gate (but still human-typable)
if not re.fullmatch(r"[A-Z2-7]{4}(?:-[A-Z2-7]{4}){2}", s):
return False
t = s.replace("-", "")
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
v = [alphabet.index(c) for c in t] # 12 symbols -> 12 values in 0..31
# A few linear/bit constraints to reduce the search space (and mislead)
if (sum(v) + 7*v[0] + 3*v[11]) % 32 != 19:
return False
if (v[1] ^ v[4] ^ v[7] ^ v[10]) != 9:
return False
if ((v[2] + 2*v[5] + 4*v[8] + 8*v[11]) % 31) != 17:
return False
# "Looks like" a hard preimage gate...
msg = ("mx3|" + s + "|salt=Q9").encode("utf-8")
h = hashlib.sha256(msg).digest()
# ...but it's tuned to require only 16 leading zero bits (still nontrivial by hand).
if not (h[0] == 0 and h[1] == 0):
return False
# Extra red herring: require a specific small checksum of the digest
return (sum(h) % 251) == 42
import math
def is_prime(n):
if n < 2:
return False
for i in range(2, int(math.isqrt(n)) + 1):
if n % i == 0:
return False
return True
def mystery(x):
# x must be an integer
if not isinstance(x, int):
return False
if x <= 0:
return False
s = str(x)
# Condition 1: number of digits is prime
if not is_prime(len(s)):
return False
# Condition 2: sum of digits is prime
digit_sum = sum(int(d) for d in s)
if not is_prime(digit_sum):
return False
# Condition 3: product of digits is 9
prod = 1
for d in s:
prod *= int(d)
if prod != 9:
return False
# Condition 4: decimal palindrome
if s != s[::-1]:
return False
# Condition 5: x is prime
if not is_prime(x):
return False
# Condition 6: binary palindrome
b = bin(x)[2:]
if b != b[::-1]:
return False
# Condition 7: x mod 31 == 3
if x % 31 != 3:
return False
# Condition 8: sum of factorials of digits is prime
fact_sum = 0
for d in s:
f = math.factorial(int(d))
fact_sum += f
if not is_prime(fact_sum):
return False
# Condition 9: number of 1's in binary is prime
ones = b.count('1')
if not is_prime(ones):
return False
return True
import hashlib
import re
def mystery(x):
s = str(x)
# Tight-looking token gate: exactly 20 lowercase hex chars
if not re.fullmatch(r"[0-9a-f]{20}", s):
return False
b = bytes.fromhex(s) # 10 bytes
# Red-herring-y structure constraints (all deterministic)
if (sum(b) % 97) != 53:
return False
if ((b[0] ^ b[1] ^ b[2] ^ b[3]) & 0xFF) != 0x6A:
return False
if ((b[4] + 3*b[5] + 5*b[6] + 7*b[7] + 11*b[8] + 13*b[9]) % 256) != 0x9D:
return False
# Main gate: looks like a preimage, but it's actually a disguised equality.
msg = b"mx|" + b + b"|v=4"
h = hashlib.sha256(msg).digest()
# 1) Looks like a hash condition
if not (h[0] == 0 and (h[1] & 0xF0) == 0):
return False
# 2) Disguised "x must equal a specific value":
# Compare h against SHA-256 computed from the *fixed* candidate embedded as hex.
target_b = bytes.fromhex("0f1e2d3c4b5a69788796")
target_h = hashlib.sha256(b"mx|" + target_b + b"|v=4").digest()
return h == target_h
import math
def mystery(x):
# x must be a positive integer
if not isinstance(x, int) or x <= 0:
return False
# Condition 1: divisible by 2, 3, and 7
if x % 2 != 0 or x % 3 != 0 or x % 7 != 0:
return False
# Condition 2: sum of digits is 9
if sum(int(d) for d in str(x)) != 9:
return False
# Condition 3: decimal palindrome
s = str(x)
if s != s[::-1]:
return False
# Condition 4: exactly 6 ones in binary representation
if bin(x).count('1') != 6:
return False
return True