def mystery(x):
N = int(
"114381625757888867669235779976146612010218296721242362562561842935706935245733"
"897830597123563958705058989075147599290026879543541"
)
return type(x) is int and 1 < x < N and N % x == 0
def mystery(x):
if type(x) is not int:
return False
if not (10**9 <= x < 10**10):
return False
s = str(x)
a = [int(c) for c in s]
b = [a.count(i) for i in range(10)]
return a == b
import hashlib
def mystery(x):
if type(x) is not str:
return False
try:
a, b = x.split(":")
except ValueError:
return False
if len(a) != 3 or len(b) != 80:
return False
return (
sum(map(ord, x)) == 4552
and hashlib.sha256(a[::-1].encode("ascii")).hexdigest()
== "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
and hashlib.md5(b[::-1].encode("ascii")).hexdigest()
== "57edf4a22be3c955ac49da2e2107b67a"
)
def mystery(x):
if type(x) is not str:
return False
if len(x) != 16:
return False
if not (x.isalpha() and x.islower()):
return False
MASK = (1 << 64) - 1
state = 0
for c in x:
state = (state * 31 + ord(c)) & MASK
return state == 1255270259644035336
def mystery(x):
if type(x) is not str:
return False
try:
a = [int(t) for t in x.split(",")]
except ValueError:
return False
n = 60
if len(a) != n or set(a) != set(range(n)):
return False
if sum((i + 1) * v for i, v in enumerate(a)) != 47475:
return False
for d in range(1, n):
seen = set()
for i in range(n - d):
delta = a[i + d] - a[i]
if delta in seen:
return False
seen.add(delta)
return True
def mystery(x):
if type(x) is not str:
return False
if len(x) != 10:
return False
if sorted(x) != list("0123456789"):
return False
if x[0] != '4':
return False
primes = [2, 3, 5, 7, 11, 13, 17]
for i, p in enumerate(primes):
if int(x[i+1:i+4]) % p != 0:
return False
return True
def mystery(x):
if type(x) is not str:
return False
if len(x) != 32 or any(c not in "0123456789abcdef" for c in x):
return False
m = int(x, 16)
v = 127
mask = (1 << v) - 1
if m >= (1 << v):
return False
if bin(m).count("1") != 63:
return False
if sum(i * ((m >> i) & 1) for i in range(v)) != 3683:
return False
for d in range(1, v):
r = ((m << d) | (m >> (v - d))) & mask
if bin(m & r).count("1") != 31:
return False
return True
def mystery(x):
if type(x) is not str:
return False
nums = x.split(",")
if len(nums) != 16:
return False
try:
a = [int(n) for n in nums]
except ValueError:
return False
if sorted(a) != list(range(1, 17)):
return False
M = 34
# Rows and columns must each sum to M
for i in range(4):
if sum(a[i*4:(i+1)*4]) != M:
return False
if sum(a[j*4 + i] for j in range(4)) != M:
return False
# Every 2x2 sub-block (with wrap-around) must sum to M
for r in range(4):
for c in range(4):
s = 0
for dr in range(2):
for dc in range(2):
s += a[((r+dr) % 4)*4 + (c+dc) % 4]
if s != M:
return False
# All 8 pandiagonals (including broken/wrapping ones) must sum to M
for d in range(4):
s1 = sum(a[i*4 + (i + d) % 4] for i in range(4))
s2 = sum(a[i*4 + (d - i) % 4] for i in range(4))
if s1 != M or s2 != M:
return False
return True
def _r(n, a):
a %= n
if a == 0:
return True
d = n - 1
s = 0
while d % 2 == 0:
s += 1
d //= 2
y = pow(a, d, n)
if y == 1 or y == n - 1:
return True
for _ in range(s - 1):
y = (y * y) % n
if y == n - 1:
return True
return False
def _p(n):
if n < 2:
return False
small = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
for q in small:
if n % q == 0:
return n == q
# Deterministic for n < 2**64.
return all(_r(n, a) for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022])
def mystery(x):
if type(x) is not int:
return False
if not (10**18 < x < 10**19):
return False
if x >= 2**64:
return False
if _p(x):
return False
if sum(map(int, str(x))) != 64:
return False
return all(_r(x, a) for a in [2, 3, 5, 7, 11, 13, 17, 19, 23])
def mystery(x):
if type(x) is not str:
return False
if len(x) != 49:
return False
if not all(c in "01" for c in x):
return False
n = 7
init = "1101000101111001001111101111011101101111010011110"
state = [int(c) for c in init]
for i, c in enumerate(x):
if c == '1':
r, col = divmod(i, n)
for dr, dc in [(0,0),(1,0),(-1,0),(0,1),(0,-1)]:
nr, nc = r+dr, col+dc
if 0 <= nr < n and 0 <= nc < n:
state[nr*n + nc] ^= 1
return all(s == 0 for s in state)