def mystery(x):
if not isinstance(x, int) or x <= 0:
return False
import math
r1 = int(math.isqrt(x))
if r1 * r1 != x:
return False
r2 = int(math.isqrt(r1))
if r2 * r2 != r1:
return False
return sum(int(d) for d in str(x)) == r2
def mystery(x):
if not isinstance(x, int):
return False
if x < 10000 or x > 99999:
return False
digits = [int(d) for d in str(x)]
if sum(digits) != 25:
return False
if sum(d*d for d in digits) != 165:
return False
if len(set(digits)) != 5:
return False
if digits != sorted(digits, reverse=True):
return False
return x % 13 == 7
def mystery(x):
if not isinstance(x, str):
return False
import re
import math
if not re.match(r'^\d{4}-\d{2}-\d{2}$', x):
return False
year, month, day = int(x[:4]), int(x[5:7]), int(x[8:10])
# Condition A
if math.isqrt(year) ** 2 != year:
return False
# Condition B
if year < 2001 or year > 2100:
return False
# Condition C
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(day):
return False
# Condition D
if math.isqrt(month + day) ** 2 != month + day:
return False
# Condition E
t = (year % 100) + month * day
if math.isqrt(t) ** 2 != t:
return False
return True
def mystery(x):
if not isinstance(x, int):
return False
s = str(x)
if len(s) != 7:
return False
if s != s[::-1]:
return False
digits = [int(d) for d in s]
if sum(digits) != 30:
return False
# middle digit must be prime
if digits[3] not in [2, 3, 5, 7]:
return False
# divisible by 77
if x % 77 != 0:
return False
# leading digit must be prime
if digits[0] not in [2, 3, 5, 7]:
return False
return True
def mystery(x):
if not isinstance(x, int):
return False
if not (10000 <= x <= 99999):
return False
s = str(x)
digits = [int(d) for d in s]
# All digits must be odd
if not all(d % 2 == 1 for d in digits):
return False
# x must be divisible by 11
if x % 11 != 0:
return False
# Digit sum must be a perfect square
import math
ds = sum(digits)
if math.isqrt(ds) ** 2 != ds:
return False
# x must be a palindrome
if s != s[::-1]:
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 8:
return False
if not (x.isalpha() and x.islower()):
return False
if list(x) != sorted(x):
return False
if len(set(x)) != 4:
return False
vals = [ord(c) - 96 for c in x]
if sum(vals) != 50:
return False
if x[0] != 'c':
return False
if x[-1] != 'm':
return False
xor = 0
for v in vals:
xor ^= v
if xor != 8:
return False
return True
def mystery(x):
if not isinstance(x, int):
return False
def is_prime(n):
if n < 2: return False
if n == 2: return True
if n % 2 == 0: return False
i = 3
while i * i <= n:
if n % i == 0: return False
i += 2
return True
# Build a well-known sequence up to 10^9
a, b = 1, 1
T = set()
while a <= 10**9:
T.add(a)
a, b = b, a + b
# Gate 1: x must belong to T
if x not in T:
return False
# Gate 2: x must be prime
if not is_prime(x):
return False
# Gate 3: digit sum of x must also belong to T
digit_sum = sum(int(c) for c in str(x))
if digit_sum not in T:
return False
# Gate 4: number of digits of x must be prime
if not is_prime(len(str(x))):
return False
# Gate 5: count of '1' bits in binary representation must be prime
ones = bin(x).count('1')
if not is_prime(ones):
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 5:
return False
if not all(c in '0123456789abcdef' for c in x):
return False
nibbles = [int(c, 16) for c in x]
pops = [bin(d).count('1') for d in nibbles]
# All five nibbles have distinct popcounts (forces them across {0,1,2,3,4})
if len(set(pops)) != 5:
return False
n = int(x, 16)
# Total bits set must be 10
if bin(n).count('1') != 10:
return False
# Sum of nibble values is 30
if sum(nibbles) != 30:
return False
# Modular constraint
if n % 97 != 42:
return False
# First and last nibble XOR
if nibbles[0] ^ nibbles[4] != 7:
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 10 or not x.isdigit():
return False
def is_prime(n):
if n < 2: return False
for d in range(2, int(n**0.5) + 1):
if n % d == 0: return False
return True
# Split into five 2-digit blocks
blocks = [int(x[i:i+2]) for i in range(0, 10, 2)]
# Each block must be prime
if not all(is_prime(b) for b in blocks):
return False
# All five blocks must be distinct
if len(set(blocks)) != 5:
return False
# Blocks must be in strictly increasing order
if blocks != sorted(blocks):
return False
# XOR of all five blocks must equal 3
xor_val = 0
for b in blocks:
xor_val ^= b
if xor_val != 3:
return False
# Sum of all five blocks must equal 99
if sum(blocks) != 99:
return False
# Product of all five blocks mod 1000 must equal 851
prod = 1
for b in blocks:
prod *= b
if prod % 1000 != 851:
return False
return True
def mystery(x):
if not isinstance(x, int):
return False
if x < 100000 or x > 999999:
return False
s = str(x)
digits = [int(c) for c in s]
# All 6 digits distinct
if len(set(digits)) != 6:
return False
# Strictly increasing
if digits != sorted(digits):
return False
# First digit + last digit = 9
if digits[0] + digits[5] != 9:
return False
# No zero digit
prod = 1
for d in digits:
prod *= d
if prod == 0:
return False
# Alternating sum equals -3
alt = digits[0] - digits[1] + digits[2] - digits[3] + digits[4] - digits[5]
if alt != -3:
return False
# Divisible by 7
if x % 7 != 0:
return False
return True