def mystery(x):
if type(x) is not str:
return False
if len(x) != 6:
return False
for c in x:
if not (('0' <= c <= '9') or ('a' <= c <= 'z')):
return False
try:
n = int(x, 36)
except:
return False
r = int(n ** 0.5)
if r * r != n:
return False
if r < 2:
return False
i = 2
while i * i <= r:
if r % i == 0:
return False
i += 1
s = 0
for c in x:
if '0' <= c <= '9':
s += ord(c) - 48
else:
s += ord(c) - 87
if s < 2:
return False
i = 2
while i * i <= s:
if s % i == 0:
return False
i += 1
return True
def mystery(x):
if type(x) is not str:
return False
if len(x) != 4:
return False
for c in x:
if not (('0' <= c <= '9') or ('a' <= c <= 'f')):
return False
try:
num = int(x, 16)
except:
return False
sqrt = int(num ** 0.5)
if sqrt * sqrt != num:
return False
if sqrt < 2:
return False
for i in range(2, int(sqrt ** 0.5) + 1):
if sqrt % i == 0:
return False
return True
def mystery(x):
if type(x) is not str:
return False
if len(x) != 5:
return False
if not x.isupper():
return False
for c in x:
if not ('A' <= c <= 'Z'):
return False
if x != x[::-1]:
return False
values = [ord(c) - ord('A') + 1 for c in x]
s = sum(values)
if s < 2:
return False
for i in range(2, int(s ** 0.5) + 1):
if s % i == 0:
return False
p = 1
for v in values:
p *= v
r = int(p ** 0.5)
if r * r != p:
return False
return True
def mystery(x):
if type(x) is not str:
return False
if len(x) != 6:
return False
# Must be a palindrome
if x != x[::-1]:
return False
# First and last must be uppercase vowels
if x[0] not in 'AEIOU' or x[0] != x[5]:
return False
# Second and fifth must be '1'
if x[1] != '1' or x[4] != '1':
return False
# Third and fourth must be the same lowercase consonant
if not x[2].islower() or x[2] != x[3] or x[2] in 'aeiou':
return False
# Consonant must be at a prime position in the alphabet
consonant_pos = ord(x[2]) - ord('a') + 1
prime_positions = [2, 3, 5, 7, 11, 13, 17, 19, 23]
if consonant_pos not in prime_positions:
return False
# Sum of character values must be 50
# (A=1, B=2, ..., Z=26; digits = face value)
vowel_val = ord(x[0]) - ord('A') + 1
consonant_val = consonant_pos
total = 2 * vowel_val + 2 * 1 + 2 * consonant_val
if total != 50:
return False
return True
def mystery(x):
if type(x) is not str:
return False
if len(x) != 5:
return False
for c in x:
if not ('A' <= c <= 'Z'):
return False
if x != x[::-1]:
return False
if x[0] not in "AEIOU":
return False
if x[0] == x[2]:
return False
values = [ord(c) - ord('A') + 1 for c in x]
s = sum(values)
if s < 2:
return False
for i in range(2, int(s**0.5) + 1):
if s % i == 0:
return False
p = 1
for v in values:
p *= v
r = int(round(p ** (1/3)))
if r * r * r != p:
return False
return True
def mystery(x):
if type(x) is not str:
return False
if len(x) != 6:
return False
# Pattern: digit-letter-digit-letter-digit-letter
for i in [0, 2, 4]:
if not x[i].isdigit():
return False
for i in [1, 3, 5]:
if not x[i].isupper():
return False
# Extract digits and letters
digits = [int(x[i]) for i in [0, 2, 4]]
letters = [x[i] for i in [1, 3, 5]]
# Digits must form an arithmetic sequence with positive difference
diff = digits[1] - digits[0]
if digits[2] - digits[1] != diff or diff <= 0:
return False
# Letters must form pattern XYX (first and last same)
if letters[0] != letters[2]:
return False
# Sum of digits must equal sum of letter positions (A=1, B=2, ..., Z=26)
digit_sum = sum(digits)
letter_sum = sum(ord(c) - ord('A') + 1 for c in letters)
if digit_sum != letter_sum:
return False
return True
def mystery(x):
# Type check
if not isinstance(x, str):
return False
# Length must be 4
if len(x) != 4:
return False
# All characters must be digits
if not x.isdigit():
return False
# No leading zero
if x[0] == '0':
return False
# Convert to integer
n = int(x)
# Must be at least 1000
if n < 1000:
return False
# Get digits
d0, d1, d2, d3 = [int(ch) for ch in x]
# Condition A: sum of digits is even
s = d0 + d1 + d2 + d3
if s % 2 != 0:
return False
# Condition B: n is divisible by s
if n % s != 0:
return False
# Condition C: n equals sum of fourth powers of digits
if d0**4 + d1**4 + d2**4 + d3**4 != n:
return False
# Condition D: product of digits is a perfect square
p = d0 * d1 * d2 * d3
# For negative product? digits are non-negative, so p>=0
import math
root = math.isqrt(p)
if root * root != p:
return False
# Condition E: not a palindrome
if x == x[::-1]:
return False
# Condition F: first digit is even
if d0 % 2 != 0:
return False
# Condition G: last digit is even
if d3 % 2 != 0:
return False
# All conditions passed
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 6:
return False
# First 3 characters must be uppercase letters
if not all('A' <= x[i] <= 'Z' for i in range(3)):
return False
# Last 3 characters must be digits
if not all(x[i].isdigit() for i in range(3, 6)):
return False
# Extract letters and digits
letters = x[:3]
digits = [int(x[i]) for i in range(3, 6)]
# Letters must be in alphabetical order
if letters != ''.join(sorted(letters)):
return False
# All digits must be distinct
if len(set(digits)) != 3:
return False
# Digits must form an arithmetic sequence when sorted
sorted_digits = sorted(digits)
common_diff = sorted_digits[1] - sorted_digits[0]
if sorted_digits[2] - sorted_digits[1] != common_diff:
return False
# Sum of letter values (A=1, B=2, ..., Z=26) must equal sum of digits
letter_sum = sum(ord(c) - ord('A') + 1 for c in letters)
digit_sum = sum(digits)
if letter_sum != digit_sum:
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 3:
return False
if not x.isdigit():
return False
if x[0] == '0':
return False
n = int(x)
if n < 100:
return False
d1, d2, d3 = map(int, x)
# Armstrong (narcissistic) condition
if d1**3 + d2**3 + d3**3 != n:
return False
# Harshad condition: divisible by sum of digits
s = d1 + d2 + d3
if n % s != 0:
return False
# Product of digits is a perfect square
p = d1 * d2 * d3
import math
if math.isqrt(p) ** 2 != p:
return False
# Ends with 0 (divisible by 10)
if n % 10 != 0:
return False
# Not a palindrome
if x == x[::-1]:
return False
# First digit is prime
if d1 not in {2, 3, 5, 7}:
return False
# Second digit is prime
if d2 not in {2, 3, 5, 7}:
return False
# Third digit is not prime
if d3 in {2, 3, 5, 7}:
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 4:
return False
# All lowercase letters
if not x.islower():
return False
# All characters must be distinct
if len(set(x)) != 4:
return False
# When sorted, characters must form an arithmetic sequence of ASCII values
sorted_x = sorted(x)
ascii_vals = [ord(c) for c in sorted_x]
diff = ascii_vals[1] - ascii_vals[0]
if ascii_vals[2] - ascii_vals[1] != diff:
return False
if ascii_vals[3] - ascii_vals[2] != diff:
return False
# The string must be a rotation of its sorted form
sorted_doubled = sorted_x + sorted_x
if x not in sorted_doubled:
return False
# First character must come before last character alphabetically
if x[0] >= x[-1]:
return False
return True