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
mask = b"ed\x7fT\x7fcnTynjgTjex|ny4"
if len(raw) != len(mask):
return False
key = bytes(a ^ b for a, b in zip(raw, mask))
target = bytes.fromhex(
"f7cf322e6c37e926a73d83c900c21d882bf10bafceafa85c5338dbd8614c34b0"
)[::-1]
return hmac.compare_digest(
hmac.new(key, b"Hi There", hashlib.sha256).digest(),
target,
)
def mystery(x):
if not isinstance(x, int) or isinstance(x, bool):
return False
if x <= 0 or x > 100000:
return False
# Condition A
count = 0
i = 1
while i * i <= x:
if x % i == 0:
count += 2 if i * i < x else 1
i += 1
if count != 48:
return False
# Condition B
if any(x % k != 0 for k in range(1, 11)):
return False
return True
def mystery(x):
import hashlib
import hmac
if type(x) is not str:
return False
try:
b = x.encode("utf-8")
except UnicodeEncodeError:
return False
if len(b) != 24:
return False
if any(c < 33 or c > 126 for c in b):
return False
s = 0x6A09E667F3BCC909
t = 0xBB67AE8584CAA73B
for i, c in enumerate(b):
s ^= (c + 0x9E3779B97F4A7C15 + ((s << 6) & ((1 << 64) - 1)) + (s >> 2)) & ((1 << 64) - 1)
s = ((s << 13) | (s >> 51)) & ((1 << 64) - 1)
t = (t + ((c ^ i) * 0x100000001B3)) & ((1 << 64) - 1)
t ^= t >> 29
if (s, t) != (0x87349B423C33C73D, 0x8F5D7F6AA22DF047):
return False
p = bytes((c ^ ((i * 73 + 41) & 255)) for i, c in enumerate(b))
q = bytes(sorted(p[::2] + p[1::2]))
return hmac.compare_digest(
hashlib.blake2s(q, digest_size=16, person=b"mystery!").hexdigest(),
"c070da728f47d8c9057eeff9c3e91249",
)
def mystery(x):
if not isinstance(x, int) or isinstance(x, bool):
return False
if x <= 0 or x > 10**9:
return False
import math
# Condition A: x must be a perfect square
r = math.isqrt(x)
if r * r != x:
return False
# Condition B: the square root of x must itself be a triangular number
# T_n = n*(n+1)/2 = r iff 1 + 8r is a perfect square
disc = 1 + 8 * r
s = math.isqrt(disc)
if s * s != disc or (s - 1) % 2 != 0:
return False
# Condition C: factorize x and inspect its prime factors
n, primes = x, set()
d = 2
while d * d <= n:
if n % d == 0:
primes.add(d)
while n % d == 0:
n //= d
d += 1
if n > 1:
primes.add(n)
# Must have exactly 5 distinct prime factors
if len(primes) != 5:
return False
# The distinct prime factors must sum to exactly 34
if sum(primes) != 34:
return False
return True
def mystery(x):
import hashlib
import hmac
if type(x) is not str:
return False
try:
b = x.encode("ascii")
except UnicodeEncodeError:
return False
if len(b) != 24:
return False
if any(c < 33 or c > 126 for c in b):
return False
tweak = [
57, 11, 242, 140, 124, 98, 20, 164,
50, 245, 196, 94, 29, 31, 230, 72,
40, 242, 235, 105, 117, 91, 255, 62,
]
p = bytes(((7 * c + tweak[i]) & 255) for i, c in enumerate(b))
dk = hashlib.pbkdf2_hmac(
"sha1",
p,
b"saltSALTsaltSALTsaltSALTsaltSALTsalt",
4096,
25,
)
masked = bytes(v ^ ((29 * i + 7) & 255) for i, v in enumerate(dk))
return hmac.compare_digest(
masked,
bytes.fromhex("3a0aad119f8431496fc4f170014079f05cdd0bb8079a75d287"),
)
def mystery(x):
if not isinstance(x, int) or isinstance(x, bool):
return False
if x <= 0 or x > 10**6:
return False
# Condition 1
s = 0
k = 1
while k * k <= x:
if x % k == 0:
s += k
if k != x // k:
s += x // k
k += 1
if s != 2 * x:
return False
# Condition 2
b = bin(x)[2:]
if b.count('1') * 2 <= len(b):
return False
# Condition 3
ds = sum(int(c) for c in str(x))
if ds < 2:
return False
if any(ds % i == 0 for i in range(2, ds)):
return False
# Condition 4
m, cnt = x, 0
d = 2
while d * d <= m:
if m % d == 0:
if d >= 100:
cnt += 1
while m % d == 0:
m //= d
d += 1
if m > 1 and m >= 100:
cnt += 1
if cnt != 1:
return False
return True
def mystery(x):
if type(x) is not int:
return False
n = 392318858461667547569595655490009919272404068553904357377
if not (1 < x < n - 1):
return False
if x.bit_length() != 185:
return False
if (x & 1) != 1:
return False
if x % 65537 != 15064:
return False
return pow(x, 2, n) == 1
def mystery(x):
if not isinstance(x, int) or isinstance(x, bool):
return False
s = str(x)
if len(s) != 10:
return False
counts = [0] * 10
for ch in s:
counts[int(ch)] += 1
for i in range(10):
if counts[i] != int(s[i]):
return False
return True
def mystery(x):
if type(x) is not int:
return False
if not (10**63 < x < 10**64):
return False
n = int(
"114381625757888867669235779976146612010218296721242362562561842935"
"706935245733897830597123563958705058989075147599290026879543541"
)
return n % x == 0
def mystery(x):
if not isinstance(x, int) or isinstance(x, bool):
return False
if x <= 1 or x > 10**9:
return False
import math
# Condition A
if (x * x - 1) % 2 != 0:
return False
half = (x * x - 1) // 2
sq = math.isqrt(half)
if sq * sq != half:
return False
# Condition B
if x < 2:
return False
for i in range(2, math.isqrt(x) + 1):
if x % i == 0:
return False
# Condition C
ds = sum(int(c) for c in str(x))
if ds < 2:
return False
for i in range(2, ds):
if ds % i == 0:
return False
# Condition D
if x <= 100:
return False
return True