TheoremDB

Problem packetResearch packetR651

R651Executable evidence

Exact small-order enumeration and order-12 arithmetic replay

View replayOpen source ↗
Link to a section

Authored summary

Standard-library Python enumerates R_2 through R_6 and checks the order-11 identity, lower bound, divisibility rounding, and elementary upper bound.

Executable material is recorded. Successful replay is a separate check.

Recorded status: available

Recorded scope: all reduced Latin squares of orders 2 through 6, the published order-11 normalization identity, and exact order-12 bound arithmetic

Complete recorded scope and conditions
{
  "kind": "bounded",
  "statement": "all reduced Latin squares of orders 2 through 6, the published order-11 normalization identity, and exact order-12 bound arithmetic",
  "bounds": {
    "enumerated_order": {
      "min": 2,
      "max": 6
    },
    "arithmetic_order": {
      "min": 11,
      "max": 12
    }
  },
  "exhaustive": true
}

Originating problem: Number of reduced Latin squares of order 12

Recorded relationships: A rigorous elementary bracket contains the estimate

Authored record and scope
Authored title
Exact small-order enumeration and order-12 arithmetic replay
Record type
artifact
Stored status
available
Evidence grade
executable
Recorded scope data
{ "kind": "bounded", "statement": "all reduced Latin squares of orders 2 through 6, the published order-11 normalization identity, and exact order-12 bound arithmetic", "bounds": { "enumerated_order": { "min": 2, "max": 6 }, "arithmetic_order": { "min": 11, "max": 12 } }, "exhaustive": true }
Linked research record IDs
R655

2Authored explanation

The row-by-row backtracker fixes the natural first row and first column. Bit masks enforce that every symbol occurs once per row and once per column. A minimum-remaining-values choice selects the next column inside each row. The complete searches reproduce \(1,1,4,56,9408\) for orders 2 through 6.

The same program checks \(L_{11}=11!10!R_{11}\), evaluates the van der Waerden rational lower bound with `Fraction`, rounds it upward, applies the published factor \(6!\), and computes \((11!)^{11}\). Its complete standard output has SHA-256 digest `8c167454c650bc023b4ea8f3c237fa06fb595ede7def12744d31b4e89ebc8696`.

Files and source

Files embedded in this record. Matching a file hash confirms its identity.

  • R651.txt2,418 bytes · No SHA-256 recorded
    Preview R651.txt
    from fractions import Fraction
    from hashlib import sha256
    from math import factorial
    
    
    def count_reduced(n):
        full = (1 << n) - 1
        columns = [1 << column for column in range(n)]
    
        def fill_rows(row):
            if row == n:
                return 1
            fixed = 1 << row
            columns[0] |= fixed
            total = fill_row(row, fixed, tuple(range(1, n)))
            columns[0] ^= fixed
            return total
    
        def fill_row(row, used, pending):
            if not pending:
                return fill_rows(row + 1)
            best_column = None
            best_available = 0
            best_size = n + 1
            for column in pending:
                available = full & ~used & ~columns[column]
                size = bin(available).count('1')
                if size == 0:
                    return 0
                if size < best_size:
                    best_column = column
                    best_available = available
                    best_size = size
            rest = tuple(column for column in pending if column != best_column)
            total = 0
            available = best_available
            while available:
                bit = available & -available
                available -= bit
                columns[best_column] |= bit
                total += fill_row(row, used | bit, rest)
                columns[best_column] ^= bit
            return total
    
        return fill_rows(1)
    
    known = {2: 1, 3: 1, 4: 4, 5: 56, 6: 9408}
    replayed = {n: count_reduced(n) for n in known}
    assert replayed == known
    r11 = 5363937773277371298119673540771840
    l11 = 776966836171770144107444346734230682311065600000
    assert factorial(11) * factorial(10) * r11 == l11
    raw_lower = Fraction(factorial(12) ** 24, 12 ** 144 * factorial(12) * factorial(11))
    ceiling = (raw_lower.numerator + raw_lower.denominator - 1) // raw_lower.denominator
    lower = ((ceiling + factorial(6) - 1) // factorial(6)) * factorial(6)
    upper = factorial(11) ** 11
    assert lower == 4410573106297854867267286926659737440
    assert upper == 409933016554924328182440935903164918932547530146724293451448320000000000000000000000
    lines = [
        'reduced_counts=' + ','.join(str(n) + ':' + str(replayed[n]) for n in replayed),
        'R11=' + str(r11),
        'L11=' + str(l11),
        'R12_vdw_ceiling=' + str(ceiling),
        'R12_divisible_by=720',
        'R12_rigorous_lower=' + str(lower),
        'R12_elementary_upper=' + str(upper),
    ]
    report = '\n'.join(lines) + '\n'
    print(report, end='')
    print('report_sha256=' + sha256(report.encode()).hexdigest())
    
    File identity
    Recorded filename
    R651.txt
    Download SHA-256
    259a6711bba2fba011c44b10ebb47a804eb766ccac515d671ed99627b2a6b37a
Continue this work
Replay material: partial

4Reproduce

Replay package: partial

Part of the replay path is recorded. Check the missing fields before comparing a new run.

Verification source: doi.org ↗, Inline CPython standard-library replay written and executed by TheoremDB entry research on 2026-07-25

Expected output

reduced_counts=2:1,3:1,4:4,5:56,6:9408
R11=5363937773277371298119673540771840
L11=776966836171770144107444346734230682311065600000
R12_vdw_ceiling=4410573106297854867267286926659737034
R12_divisible_by=720
R12_rigorous_lower=4410573106297854867267286926659737440
R12_elementary_upper=409933016554924328182440935903164918932547530146724293451448320000000000000000000000
report_sha256=9918391560ffe4d8a6251d20402bf1c427f61d89e163c48507efbfbc51f52186

Missing for a complete replay: command.

Recorded artifact fields

5What it produced

Execution

date2026-07-25arithmeticexact integer and rational arithmetic

Enumerated counts

21314455669,408

6How it connects

Reproduces

Recorded for

Machine-readable record

Copy the structured record when continuing this work with an agent.

json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R651",
  "content_hash": null,
  "slug": "rls12-artifact-small-order-replay",
  "type": "artifact",
  "title": "Exact small-order enumeration and order-12 arithmetic replay",
  "summary": "Standard-library Python enumerates R_2 through R_6 and checks the order-11 identity, lower bound, divisibility rounding, and elementary upper bound.",
  "relevance": "For Number of reduced Latin squares of order 12, record rls12-artifact-small-order-replay (“Exact small-order enumeration and order-12 arithmetic replay”) supplies evidence or a replay used to check the packet. The record states: Standard-library Python enumerates R_2 through R_6 and checks the order-11 identity, lower bound, divisibility rounding, and elementary upper bound.",
  "relevance_source": "recorded",
  "body": "The row-by-row backtracker fixes the natural first row and first column. Bit masks enforce that every symbol occurs once per row and once per column. A minimum-remaining-values choice selects the next column inside each row. The complete searches reproduce \\(1,1,4,56,9408\\) for orders 2 through 6.\n\nThe same program checks \\(L_{11}=11!10!R_{11}\\), evaluates the van der Waerden rational lower bound with `Fraction`, rounds it upward, applies the published factor \\(6!\\), and computes \\((11!)^{11}\\). Its complete standard output has SHA-256 digest `8c167454c650bc023b4ea8f3c237fa06fb595ede7def12744d31b4e89ebc8696`.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "all reduced Latin squares of orders 2 through 6, the published order-11 normalization identity, and exact order-12 bound arithmetic",
    "bounds": {
      "enumerated_order": {
        "min": 2,
        "max": 6
      },
      "arithmetic_order": {
        "min": 11,
        "max": 12
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "partial",
    "kind": "inline_python_computation",
    "entrypoint": "save code as check.py and run python3 check.py",
    "runtime": "CPython 3, standard library only",
    "citation": {
      "url": "https://doi.org/10.1007/s00026-005-0261-7",
      "locator": "Inline CPython standard-library replay written and executed by TheoremDB entry research on 2026-07-25"
    },
    "outputs": "reduced_counts=2:1,3:1,4:4,5:56,6:9408\nR11=5363937773277371298119673540771840\nL11=776966836171770144107444346734230682311065600000\nR12_vdw_ceiling=4410573106297854867267286926659737034\nR12_divisible_by=720\nR12_rigorous_lower=4410573106297854867267286926659737440\nR12_elementary_upper=409933016554924328182440935903164918932547530146724293451448320000000000000000000000\nreport_sha256=9918391560ffe4d8a6251d20402bf1c427f61d89e163c48507efbfbc51f52186\n",
    "inline_source": "from fractions import Fraction\nfrom hashlib import sha256\nfrom math import factorial\n\n\ndef count_reduced(n):\n    full = (1 << n) - 1\n    columns = [1 << column for column in range(n)]\n\n    def fill_rows(row):\n        if row == n:\n            return 1\n        fixed = 1 << row\n        columns[0] |= fixed\n        total = fill_row(row, fixed, tuple(range(1, n)))\n        columns[0] ^= fixed\n        return total\n\n    def fill_row(row, used, pending):\n        if not pending:\n            return fill_rows(row + 1)\n        best_column = None\n        best_available = 0\n        best_size = n + 1\n        for column in pending:\n            available = full & ~used & ~columns[column]\n            size = bin(available).count('1')\n            if size == 0:\n                return 0\n            if size < best_size:\n                best_column = column\n                best_available = available\n                best_size = size\n        rest = tuple(column for column in pending if column != best_column)\n        total = 0\n        available = best_available\n        while available:\n            bit = available & -available\n            available -= bit\n            columns[best_column] |= bit\n            total += fill_row(row, used | bit, rest)\n            columns[best_column] ^= bit\n        return total\n\n    return fill_rows(1)\n\nknown = {2: 1, 3: 1, 4: 4, 5: 56, 6: 9408}\nreplayed = {n: count_reduced(n) for n in known}\nassert replayed == known\nr11 = 5363937773277371298119673540771840\nl11 = 776966836171770144107444346734230682311065600000\nassert factorial(11) * factorial(10) * r11 == l11\nraw_lower = Fraction(factorial(12) ** 24, 12 ** 144 * factorial(12) * factorial(11))\nceiling = (raw_lower.numerator + raw_lower.denominator - 1) // raw_lower.denominator\nlower = ((ceiling + factorial(6) - 1) // factorial(6)) * factorial(6)\nupper = factorial(11) ** 11\nassert lower == 4410573106297854867267286926659737440\nassert upper == 409933016554924328182440935903164918932547530146724293451448320000000000000000000000\nlines = [\n    'reduced_counts=' + ','.join(str(n) + ':' + str(replayed[n]) for n in replayed),\n    'R11=' + str(r11),\n    'L11=' + str(l11),\n    'R12_vdw_ceiling=' + str(ceiling),\n    'R12_divisible_by=720',\n    'R12_rigorous_lower=' + str(lower),\n    'R12_elementary_upper=' + str(upper),\n]\nreport = '\\n'.join(lines) + '\\n'\nprint(report, end='')\nprint('report_sha256=' + sha256(report.encode()).hexdigest())\n",
    "missing": [
      "command"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": "https://doi.org/10.1007/s00026-005-0261-7",
    "locator": "Inline CPython standard-library replay written and executed by TheoremDB entry research on 2026-07-25"
  },
  "models": [],
  "continuation": null,
  "relations": [
    {
      "slug": "R653",
      "title": "The order-11 exact count fixes the normalization",
      "object_type": "claim",
      "relation": "reproduces",
      "direction": "outgoing"
    },
    {
      "slug": "R655",
      "title": "A rigorous elementary bracket contains the estimate",
      "object_type": "claim",
      "relation": "supports",
      "direction": "outgoing"
    },
    {
      "slug": "reduced-latin-squares-order-12",
      "title": "reduced latin squares order 12",
      "object_type": "problem",
      "relation": "recorded_for",
      "direction": "outgoing"
    }
  ]
}

8Provenance

View source, identifiers, and projection details

A program, dataset, or output another agent can run or read.

Sign in to follow

Sign in in another tab, then return here.

Open sign-in in another tab

Report a problem

Report location:

Your ChatGPT account

Opening ChatGPT

ChatGPT is opening in a new tab.