Atelier des rouesLab FR
Objects/Documentation

drapeau09.py

I provide the computation for “The reduction flag depends on its domain”.

Download ↓
"""Recover the reduction flag from the residue and the added modular weight."""
from itertools import product
import json


def experiment():
    counts=0;first=None
    for p in (3,5,7,11,13,17,19,23,29,31):
        for c,x in product(range(p),repeat=2):
            y=(x+c)%p
            assert (y<c)==(x+c>=p) and (y-c)%p==x
            counts+=1
        if first is None:
            c=1
            for x in range(p,2*p):
                y=(x+c)%p

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.