def mystery(x):
if isinstance(x, int):
if x < 0:
return False
s = str(x)
elif isinstance(x, str):
s = x
else:
return False
if len(s) != 10:
return False
mod1 = 997
mod2 = 10007
mod3 = 100003
sum1 = 0
sum2 = 0
prod = 1
for i, c in enumerate(s):
v = ord(c)
sum1 = (sum1 + v * (i + 1)) % mod1
sum2 = (sum2 + v * (10 - i)) % mod2
prod = (prod * (v + i)) % mod3
return sum1 == 714 and sum2 == 5293 and prod == 27445
def mystery(x):
if type(x) is not int or x < 10**8 or x >= 10**9:
return False
q = [int(c) for c in str(x)]
if sorted(q) != list(range(1,10)):
return False
return (sum(v*(i+1) for i,v in enumerate(q)) == 235 and
sum(abs(q[i+1]-q[i]) for i in range(8)) == 36 and
q[1]+q[3]+q[5]+q[7] == 30)
def mystery(x):
# Accept either non‑negative integer or string.
if isinstance(x, int):
if x < 0:
return False
s = str(x)
elif isinstance(x, str):
s = x
else:
return False
# Must be exactly 16 characters long, all printable ASCII.
if len(s) != 16:
return False
for c in s:
if ord(c) < 32 or ord(c) > 126:
return False
# Moduli (all prime)
mod1 = 1000003
mod2 = 1000033
mod3 = 100019
mod4 = 999983
sum1 = 0
sum2 = 0
sum3 = 0
prod4 = 1
for i, c in enumerate(s):
v = ord(c)
# First checksum: weighted sum with forward weights
sum1 = (sum1 + (i + 1) * v) % mod1
# Second checksum: weighted sum with reverse weights
sum2 = (sum2 + (16 - i) * v) % mod2
# Third checksum: sum of squares
sum3 = (sum3 + v * v) % mod3
# Fourth checksum: product of (v + i)
prod4 = (prod4 * (v + i)) % mod4
# Target values computed from a secret solution
return (sum1 == 13047 and sum2 == 14323 and
sum3 == 69911 and prod4 == 49479)
def mystery(x):
if not isinstance(x, str) or len(x) != 8:
return False
for c in x:
if ord(c) < 33 or ord(c) > 126:
return False
h1 = sum(ord(c) * (i + 1) for i, c in enumerate(x)) % 9973
h2 = sum(ord(c) * (8 - i) for i, c in enumerate(x)) % 9967
h3 = sum(ord(c) ** 2 for c in x) % 9949
p = 1
for i, c in enumerate(x):
p = (p * (ord(c) + i * 7)) % 99991
return h1 == 3220 and h2 == 3395 and h3 == 5526 and p == 87646
def mystery(x):
"""
Returns True if x satisfies several intricate checks.
x must be a non-negative integer or a string of length 12.
All characters must be printable ASCII (codes 33-126).
"""
# Input validation
if isinstance(x, int):
if x < 0:
return False
s = str(x)
elif isinstance(x, str):
s = x
else:
return False
if len(s) != 12:
return False
for ch in s:
if ord(ch) < 33 or ord(ch) > 126:
return False
# Moduli
M1 = 1000003
M2 = 1000033
M3 = 999983
# Initialize accumulators
a = 0
b = 1
c = 0
d = 0
for i, ch in enumerate(s):
v = ord(ch)
# Accumulator a: (i+1) * (v XOR (i*7)) mod M1
a = (a + (i + 1) * (v ^ (i * 7))) % M1
# Accumulator b: product of (v + i*11) mod M2
b = (b * (v + i * 11)) % M2
# Accumulator c: recurrent hash mod M3
c = (c * 31 + v) % M3
# Accumulator d: XOR with shifted v
d = d ^ (v << (i % 8))
# Target values (derived from a secret solution)
return (a == 5526 and b == 414045 and c == 51852 and d == 14852)
def mystery(x):
if not isinstance(x, str) or len(x) != 8:
return False
for c in x:
if ord(c) < 33 or ord(c) > 126:
return False
# Forward weighted sum
s1 = sum((i + 1) * ord(c) for i, c in enumerate(x)) % 99991
# Reverse weighted sum
s2 = sum((8 - i) * ord(c) for i, c in enumerate(x)) % 99989
# Sum of squares
s3 = sum(ord(c) ** 2 for c in x) % 99971
# Product
p = 1
for c in x:
p = (p * ord(c)) % 999983
# Polynomial hash
h = 0
for c in x:
h = (h * 31 + ord(c)) % 100003
return s1 == 2980 and s2 == 3176 and s3 == 64586 and p == 540952 and h == 93503
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
mod1 = 997
mod2 = 1009
mod3 = 1013
mod4 = 1019
a = 0
b = 1
c = 0
d = 0
for i, ch in enumerate(x):
v = ord(ch)
a = (a + (v ^ (i * 17))) % mod1
b = (b * (v + i * 13)) % mod2
c = (c * 31 + v) % mod3
d = (d + pow(v, i + 1, mod4)) % mod4
return a == 552 and b == 729 and c == 42 and d == 499
def mystery(x):
if not isinstance(x, str) or len(x) != 10:
return False
for c in x:
if ord(c) < 33 or ord(c) > 126:
return False
mod1 = 99991
mod2 = 99989
mod3 = 100003
mod4 = 99971
# Forward weighted sum
s1 = sum((i + 1) * ord(c) for i, c in enumerate(x)) % mod1
# Product with position offset
p = 1
for i, c in enumerate(x):
p = (p * (ord(c) + i * 7)) % mod2
# Polynomial hash
h = 0
for c in x:
h = (h * 37 + ord(c)) % mod3
# Sum of squares
s4 = sum(ord(c) ** 2 for c in x) % mod4
# Sum of adjacent differences
d = sum(abs(ord(x[i+1]) - ord(x[i])) for i in range(9))
return s1 == 4528 and p == 30661 and h == 35654 and s4 == 73924 and d == 469
def mystery(x):
if not isinstance(x, str) or len(x) != 9:
return False
for c in x:
if ord(c) < 33 or ord(c) > 126:
return False
mod1 = 10007
mod2 = 10009
mod3 = 10037
s1 = 0
p2 = 1
h3 = 0
for i, ch in enumerate(x):
v = ord(ch)
term = (v * (i + 1)) ^ (v % (i + 2))
s1 = (s1 + term) % mod1
p2 = (p2 * (v + i * 13)) % mod2
h3 = (h3 * 41 + v) % mod3
return s1 == 4488 and p2 == 3991 and h3 == 5090
def mystery(x):
if not isinstance(x, str) or len(x) != 10:
return False
for c in x:
if ord(c) < 33 or ord(c) > 126:
return False
mod1 = 10007
mod2 = 10009
mod3 = 10037
mod4 = 9973
s1 = 0
for i, c in enumerate(x):
v = ord(c)
s1 = (s1 + v * ((i + 1) ^ (v % 7))) % mod1
p = 1
for i, c in enumerate(x):
v = ord(c)
p = (p * ((v ^ i) + 17)) % mod2
h = 0
for c in x:
h = (h * 43 + ord(c)) % mod3
cs = 0
for i, c in enumerate(x):
v = ord(c)
cs = (cs + pow(v, (i % 3) + 1, mod4)) % mod4
return s1 == 4264 and p == 8471 and h == 6310 and cs == 7399