Atelier des rouesLab FR
Objects/Documentation

segments20.py

I provide the code for this calculation. segments20.py

Download ↓
"""Shortest decodable segmentation of up to 64 words. Stdlib, 32 bits per word."""
from itertools import groupby,product
from math import comb
import json
from flux18 import rank,unrank


def options(words,i):
    weight=words[i].bit_count()
    width=(comb(32,weight)-1).bit_length()
    uniform=True
    for j in range(i+1,min(i+64,len(words))+1):
        uniform &= words[j-1].bit_count()==weight
        yield j,0,7+32*(j-i)
        if uniform:
            yield j,1,13+width*(j-i)

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.