def mystery(x):
from math import factorial
if isinstance(x, bool) or not isinstance(x, int) or x < 0:
return False
s = str(x)
return sum(factorial(int(digit)) for digit in s) == x
def mystery(x):
import math
# x must be a string
if not isinstance(x, str):
return False
# Check if x is a palindrome
if x != x[::-1]:
return False
# Check if length of x is prime
n = len(x)
if n < 2:
return False
for i in range(2, int(math.isqrt(n)) + 1):
if n % i == 0:
return False
# Compute sum and product of ASCII values
total = 0
prod = 1
for ch in x:
v = ord(ch)
total += v
prod *= v
# Check if total is prime
if total < 2:
return False
for i in range(2, int(math.isqrt(total)) + 1):
if total % i == 0:
return False
# Check if binary representation of total is a palindrome
b = bin(total)[2:]
if b != b[::-1]:
return False
# Check if product is a perfect square
root = math.isqrt(prod)
if root * root != prod:
return False
return True
def mystery(x):
if not isinstance(x, str) or len(x) == 0:
return False
# Must be lowercase letters only
if not x.islower() or not x.isalpha():
return False
# Length must be odd
if len(x) % 2 == 0:
return False
# Check if it's a palindrome
if x != x[::-1]:
return False
vowels = set('aeiou')
consonants = set('bcdfghjklmnpqrstvwxyz')
has_vowel = any(c in vowels for c in x)
has_consonant = any(c in consonants for c in x)
# Must have both vowels and consonants
if not has_vowel or not has_consonant:
return False
# Check if the middle character is a vowel
middle_idx = len(x) // 2
if x[middle_idx] not in vowels:
return False
# Check if the number of vowels equals the number of consonants plus 1
vowel_count = sum(1 for c in x if c in vowels)
consonant_count = sum(1 for c in x if c in consonants)
if vowel_count != consonant_count + 1:
return False
# Check if all consonants are the same letter
consonant_set = set(c for c in x if c in consonants)
if len(consonant_set) != 1:
return False
return True
def mystery(x):
# Check if x is a positive integer
if not isinstance(x, int) or x <= 0:
return False
s = str(x)
# Must have exactly 5 digits
if len(s) != 5:
return False
# Must be a palindrome
if s != s[::-1]:
return False
# Must contain exactly three distinct digits
if len(set(s)) != 3:
return False
# Sum of digits must be prime
digit_sum = sum(int(d) for d in s)
if digit_sum < 2:
return False
for i in range(2, int(digit_sum ** 0.5) + 1):
if digit_sum % i == 0:
return False
# Product of digits must be a perfect cube
digit_product = 1
for d in s:
digit_product *= int(d)
if digit_product != 0:
# Compute integer cube root
root = int(round(digit_product ** (1/3)))
if root ** 3 != digit_product:
# Try adjacent integer
if (root + 1) ** 3 != digit_product and (root - 1) ** 3 != digit_product:
return False
# x itself must be prime
if x % 2 == 0 or x % 5 == 0:
return False
for i in range(3, int(x ** 0.5) + 1, 2):
if x % i == 0:
return False
# x squared must be a palindrome
sq = x * x
if str(sq) != str(sq)[::-1]:
return False
# x modulo 7 must equal 4
if x % 7 != 4:
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 4:
return False
if not x.isalpha() or not x.islower():
return False
# All characters must be distinct
if len(set(x)) != 4:
return False
# Sum of ASCII values must be divisible by 3
ascii_sum = sum(ord(c) for c in x)
if ascii_sum % 3 != 0:
return False
# Product of character positions in alphabet (0-25) must equal 120
product = 1
for c in x:
product *= (ord(c) - ord('a'))
if product != 120:
return False
# Characters must be in alphabetical order
if x != ''.join(sorted(x)):
return False
return True
def mystery(x):
# Check input type and positivity
if not isinstance(x, int) or x <= 0:
return False
# Decimal palindrome
s = str(x)
if s != s[::-1]:
return False
# Binary palindrome
b = bin(x)[2:]
if b != b[::-1]:
return False
# Divisibility by 3 and 11
if x % 3 != 0 or x % 11 != 0:
return False
# Not prime (composite)
if x < 2:
return False
is_prime = True
for i in range(2, int(x**0.5) + 1):
if x % i == 0:
is_prime = False
break
if is_prime:
return False
# Product of digits is a perfect square
prod = 1
for ch in s:
prod *= int(ch)
if prod <= 0:
return False
root = int(prod ** 0.5)
if root * root != prod:
return False
# Sum of digits is a triangular number
total = sum(int(d) for d in s)
n = int((2 * total) ** 0.5)
if n * (n + 1) != 2 * total:
return False
# Congruence modulo 13
if x % 13 != 7:
return False
return True
def mystery(x):
# Exclude booleans (which are technically ints in Python)
if isinstance(x, bool):
return False
# Must be a 4-digit positive integer
if not isinstance(x, int) or x < 1000 or x >= 10000:
return False
# Must be divisible by 37
if x % 37 != 0:
return False
# All digits must be distinct
s = str(x)
if len(set(s)) != 4:
return False
# Sum of digits must be a perfect square
digit_sum = sum(int(d) for d in s)
root = int(digit_sum ** 0.5)
if root * root != digit_sum:
return False
# Must not be a perfect square itself
sqrt_x = int(x ** 0.5)
if sqrt_x * sqrt_x == x:
return False
# x modulo 11 must equal 5
if x % 11 != 5:
return False
return True
def mystery(x):
import math
# x must be a positive integer
if not isinstance(x, int) or x <= 0:
return False
# x must have exactly 6 digits
if x < 100000 or x > 999999:
return False
s = str(x)
# x must be a palindrome
if s != s[::-1]:
return False
# x must be a perfect square
root = int(math.isqrt(x))
if root * root != x:
return False
# product of digits must be a perfect square and non-zero
prod = 1
for ch in s:
prod *= int(ch)
if prod <= 0:
return False
prod_root = int(math.isqrt(prod))
if prod_root * prod_root != prod:
return False
# x must be divisible by 11
if x % 11 != 0:
return False
# x must not be divisible by 3
if x % 3 == 0:
return False
# x modulo 7 must be 2
if x % 7 != 2:
return False
# x modulo 13 must be 3
if x % 13 != 3:
return False
# sum of digits must be twice a prime
digit_sum = sum(int(d) for d in s)
if digit_sum % 2 != 0:
return False
half = digit_sum // 2
if half < 2:
return False
for i in range(2, int(math.isqrt(half)) + 1):
if half % i == 0:
return False
# square root of x must be even
if root % 2 != 0:
return False
# square root of x must not be a palindrome
if str(root) == str(root)[::-1]:
return False
# (digit_sum^2 - 1) must be divisible by 5
if (digit_sum * digit_sum - 1) % 5 != 0:
return False
return True
def mystery(x):
# Must be a string
if not isinstance(x, str):
return False
# Must be exactly 5 characters long
if len(x) != 5:
return False
# Must contain only uppercase letters
if not x.isupper() or not x.isalpha():
return False
# Must start with a vowel
vowels = set('AEIOU')
if x[0] not in vowels:
return False
# Must end with a consonant
if x[-1] in vowels:
return False
# Sum of character positions (A=1, B=2, ..., Z=26) must be divisible by 5
position_sum = sum(ord(c) - ord('A') + 1 for c in x)
if position_sum % 5 != 0:
return False
# Must contain exactly 2 distinct vowels total
vowel_set = set(c for c in x if c in vowels)
if len(vowel_set) != 2:
return False
# Must contain exactly 3 distinct consonants total
consonant_set = set(c for c in x if c not in vowels)
if len(consonant_set) != 3:
return False
# The count of each vowel must be equal
from collections import Counter
char_counts = Counter(x)
vowel_counts = [char_counts[v] for v in vowel_set]
if vowel_counts[0] != vowel_counts[1]:
return False
# The two vowels must not be adjacent
vowel_positions = [i for i, c in enumerate(x) if c in vowels]
if len(vowel_positions) == 2 and vowel_positions[1] - vowel_positions[0] == 1:
return False
return True
def mystery(x):
# x must be a string
if not isinstance(x, str):
return False
# must be exactly 5 characters long
if len(x) != 5:
return False
# must be all uppercase letters
if not x.isupper() or not x.isalpha():
return False
# must be a palindrome
if x != x[::-1]:
return False
# must contain exactly two distinct letters
if len(set(x)) != 2:
return False
# both letters must be consonants
vowels = set('AEIOU')
for ch in x:
if ch in vowels:
return False
# the two distinct letters must be consecutive in the alphabet
letters = sorted(set(x))
if ord(letters[1]) - ord(letters[0]) != 1:
return False
# sum of letter positions (A=1, B=2, ..., Z=26) must be prime
total = 0
for ch in x:
total += ord(ch) - ord('A') + 1
if total < 2:
return False
for i in range(2, int(total**0.5) + 1):
if total % i == 0:
return False
# product of letter positions must be a perfect cube
prod = 1
for ch in x:
prod *= ord(ch) - ord('A') + 1
# check if prod is a perfect cube
cube_root = round(prod ** (1/3))
if cube_root ** 3 != prod:
return False
return True