Atelier des rouesLab FR
Objects/Documentation

temoins31.py

Identifying a format with three lengths · temoins31.py

Download ↓
"""Minimum number of tested stream lengths separating all seven realized width residues."""
from itertools import combinations
from math import comb
import json

def gap(n,w):
    bits=n.bit_length();body=1+13*((n+63)//64)+n*w
    return (body+2*bits-1+7)//8-(body+7)//8-(bits+6)//7

def study():
    residues=sorted({(comb(32,k)-1).bit_length()%8 for k in range(33)});pairs=list(combinations(range(len(residues)),2));patterns={};witness={}
    for n in range(1,65537):
        values=tuple(gap(n,w) for w in residues);mask=sum(1<<i for i,(a,b) in enumerate(pairs) if values[a]!=values[b])
        assert len(set(values))<=2
        if mask:patterns.setdefault(mask,n)
        for a,b in pairs:

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.