def mystery(x):
s = str(x)
if len(s) < 3:
return False
product = 1
for c in s:
if c.isdigit():
product *= int(c)
return product == 120
def mystery(x):
if not isinstance(x, int):
return False
if x <= 0 or x > 10**12:
return False
s = str(x)
for i in range(len(s) - 1):
if int(s[i]) % 2 == int(s[i+1]) % 2:
return False
alt_sum = sum((-1)**i * int(d) for i, d in enumerate(s))
if alt_sum == 0 or x % abs(alt_sum) != 0:
return False
n = len(s)
if n < 2 or any(n % i == 0 for i in range(2, n)):
return False
return sum(int(d) for d in s) == int(s[0]) * int(s[-1])
def mystery(x):
if not isinstance(x, int) or x <= 0:
return False
s = str(x)
if len(s) < 2:
return False
# Check first property
rev = int(s[::-1])
sum_val = x + rev
sum_str = str(sum_val)
if sum_str != sum_str[::-1]:
return False
# Check second property
binary = bin(x)[2:]
if binary.count('0') != binary.count('1'):
return False
return True
def mystery(x):
if not isinstance(x, int) or x <= 100 or x >= 10000000:
return False
s = str(x)
n = len(s)
# x equals sum of nth powers of its digits
if sum(int(d)**n for d in s) != x:
return False
# x must have at least 4 digits
if n < 4:
return False
# First digit must equal last digit
if s[0] != s[-1]:
return False
return True
def mystery(x):
s = str(x)
if len(s) < 4:
return False
# Sum of squares of digits must equal a triangular number
sum_squares = sum(int(d)**2 for d in s)
# Check if sum_squares is triangular: n(n+1)/2 for some n
discriminant = 1 + 8 * sum_squares
sqrt_disc = int(discriminant ** 0.5)
if sqrt_disc * sqrt_disc != discriminant:
return False
n = (-1 + sqrt_disc) / 2
if n != int(n) or n < 0:
return False
# Product of digits must be composite (not prime, not 0, not 1)
product = 1
has_zero = False
for d in s:
digit = int(d)
if digit == 0:
has_zero = True
product *= digit
if has_zero or product <= 1:
return False
# Check if product is composite
if product == 2 or product == 3:
return False
is_prime = True
for i in range(2, int(product**0.5) + 1):
if product % i == 0:
is_prime = False
break
if is_prime:
return False
return True
def mystery(x):
if not isinstance(x, str) or len(x) != 8:
return False
for c in x:
if ord(c) < 32 or ord(c) > 126:
return False
if x[0] != x[-1]:
return False
h = 0
for i, c in enumerate(x):
h = (h + (ord(c) - 31) * (i + 1)) % 10007
if h != 2024:
return False
if not any(c.isdigit() for c in x):
return False
if sum(ord(c) for c in x) % 7 != 0:
return False
return True
def mystery(x):
if not isinstance(x, int) or x <= 0:
return False
s = str(x)
if len(s) < 3:
return False
# All digits must be non-zero
if '0' in s:
return False
# Sum of digits must be a perfect square
digit_sum = sum(int(d) for d in s)
sqrt_sum = int(digit_sum ** 0.5)
if sqrt_sum * sqrt_sum != digit_sum:
return False
# Product of digits must be a perfect cube
product = 1
for d in s:
product *= int(d)
cube_root = round(product ** (1/3))
if cube_root ** 3 != product:
return False
# The number itself must be divisible by 11
if x % 11 != 0:
return False
return True
def mystery(x):
if not isinstance(x, int) or x <= 0:
return False
s = str(x)
if len(s) != 8:
return False
# All digits must be distinct
if len(set(s)) != 8:
return False
# No zeros
if '0' in s:
return False
# The number formed by odd-positioned digits (1st, 3rd, 5th, 7th) must be a perfect square
odd_pos = int(s[0] + s[2] + s[4] + s[6])
sqrt_odd = int(odd_pos ** 0.5)
if sqrt_odd * sqrt_odd != odd_pos:
return False
# The number formed by even-positioned digits (2nd, 4th, 6th, 8th) must be a perfect cube
even_pos = int(s[1] + s[3] + s[5] + s[7])
cube_root = round(even_pos ** (1/3))
if cube_root ** 3 != even_pos:
return False
# x must be divisible by 11
if x % 11 != 0:
return False
return True
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 6:
return False
# Must contain exactly 3 distinct characters
if len(set(x)) != 3:
return False
# Each character must appear exactly twice
from collections import Counter
counts = Counter(x)
if not all(c == 2 for c in counts.values()):
return False
# First pair must equal reverse of last pair
if x[0:2] != x[4:6][::-1]:
return False
# Sum of ASCII values must be divisible by 13
if sum(ord(c) for c in x) % 13 != 0:
return False
return True
def mystery(x):
if not isinstance(x, int) or x <= 0:
return False
s = str(x)
n = len(s)
if n != 6:
return False
# All digits distinct
if len(set(s)) != 6:
return False
# Sum of digits is a perfect cube
digit_sum = sum(int(d) for d in s)
cube_root = round(digit_sum ** (1/3))
if cube_root ** 3 != digit_sum:
return False
# First 3 digits > Last 3 digits (as numbers)
if int(s[:3]) <= int(s[3:]):
return False
# x divisible by 9
if x % 9 != 0:
return False
# Middle two digits are consecutive integers
if abs(int(s[2]) - int(s[3])) != 1:
return False
return True