#!/usr/bin/env python3 """job2545-inspect.py -- exact residue counts P(r) for m in {3,19,23,29}, folds p=29,31,37.""" import importlib.util as _iu, numpy as np _s = _iu.spec_from_file_location("j", "job2545-posres.py") J = _iu.module_from_spec(_s); _s.loader.exec_module(J) word, W, G2 = J.gap_word([q for q in J.PRIMES if q <= 23]) idx = np.arange(word.size) for p in (29, 31, 37): mask = J.mask_of(word, p) K = int(mask.sum()) for m in (3, 19, 23, 29): P = np.bincount((idx % m)[mask], minlength=m).astype(int) print("p=%d m=%d K=%d P=%s dev_max=%d" % (p, m, K, list(P), int(np.max(np.abs(P - K / m)))))