def mystery(x):
if not isinstance(x, int) or x < 1:
return False
square = x * x
s = str(square)
for i in range(1, len(s)):
left = int(s[:i])
right = int(s[i:])
if left + right == x:
return True
return False
import base64
import codecs
import hashlib
def mystery(x):
if type(x) is not str or len(x) != 60:
return False
try:
t = codecs.decode(x[::-1], "rot_13")
payload = base64.b64decode(t, validate=True)
except Exception:
return False
if base64.b64encode(payload).decode("ascii") != t:
return False
return (
hashlib.md5(payload).hexdigest() == "9e107d9d372bb6826bd81d3542a419d6"
and hashlib.sha1(payload).hexdigest() == "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"
and hashlib.sha256(payload).hexdigest()
== "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592"
)
def mystery(x):
if not isinstance(x, int) or x < 1:
return False
# Estimate cube root
cr = round(x ** (1/3))
# Check cr and nearby values for floating point safety
for test_cr in [max(1, cr - 1), cr, cr + 1]:
if test_cr ** 3 == x:
# This is the actual cube root
digit_sum = sum(int(d) for d in str(x))
return digit_sum == test_cr
return False
def mystery(x):
if type(x) is not int:
return False
n = (
114381625757888867669235779976146612010218296721242362562561842935706935245733897830597123563958705058989075147599290026879543541
)
return 1 < x and x * x < n and n % x == 0
def mystery(x):
if not isinstance(x, int) or x < 1:
return False
# Precompute factorials
factorials = [1] # 0! = 1
for i in range(1, 10):
factorials.append(factorials[-1] * i)
# Calculate sum of factorials of digits
digit_sum_of_factorials = sum(factorials[int(d)] for d in str(x))
return digit_sum_of_factorials == x
import hashlib
def mystery(x):
if type(x) is not str:
return False
try:
password = x.encode("latin-1")
except UnicodeEncodeError:
return False
if not (1 <= len(password) <= 32):
return False
derived = hashlib.pbkdf2_hmac(
"sha1",
password,
b"sa\x00lt",
4096,
16,
)
return derived.hex() == "56fa6aa75548099dcc37d7f03425e0c3"
def mystery(x):
if not isinstance(x, int) or x < 1:
return False
seen = set()
while x != 1 and x not in seen:
seen.add(x)
x = sum(int(d) ** 2 for d in str(x))
return x == 1
import hashlib
def mystery(x):
if type(x) is not str:
return False
if len(x) != 56 or not x.isascii() or not x.islower():
return False
alphabet = "abcdefghijklmnopqrstuvwxyz"
table = str.maketrans(alphabet[::-1], alphabet)
payload = x.translate(table).encode("ascii")
return (
hashlib.sha1(payload).digest()
== bytes.fromhex("f17046e5e52951f9a14aaeba6ed23b1c443e9884")[::-1]
and hashlib.sha256(payload).digest()
== bytes.fromhex(
"c106db19d4edecf66721ff6459e43ca339603e0c9326c0e5b83806d2616a8d24"
)[::-1]
)
def mystery(x):
if not isinstance(x, int) or x < 1:
return False
s = str(x)
n = len(s)
# Vampire numbers must have even number of digits, at least 4
if n % 2 != 0 or n < 4:
return False
half = n // 2
original_digits = sorted(s)
# Find divisors up to sqrt(x)
start = 10**(half-1)
end = 10**half
for i in range(start, min(end, int(x**0.5) + 1)):
if x % i == 0:
j = x // i
# Check if j has the right number of digits
if len(str(j)) != half:
continue
# Check if digits match
combined_digits = sorted(str(i) + str(j))
if combined_digits == original_digits:
return True
return False
import hashlib
import hmac
def mystery(x):
if type(x) is not str:
return False
try:
raw = x.encode("latin-1")
except UnicodeEncodeError:
return False
if len(raw) != 22:
return False
msg = bytes(b ^ 0xA5 for b in raw)
salt = bytes(range(13))
info = bytes(range(0xF0, 0xFA))
key = hmac.new(salt, msg, hashlib.sha256).digest()
out = b""
block = b""
for counter in (1, 2):
block = hmac.new(key, block + info + bytes([counter]), hashlib.sha256).digest()
out += block
return hmac.compare_digest(
out[:42],
bytes.fromhex(
"3cb25f25faacd57a90434f64d0362f2a"
"2d2d0a90cf1a5a4c5db02d56ecc4c5bf"
"34007208d5b887185865"
),
)