TheoremDB
R807artifactStatus: availableEvidence: ReproducedReplay: partialexhaustive over its scope

[#R807] Exact coefficient sweep through n = 300

View replayOpen source ↗

1Summary

Standard-library Python checks symmetry, total mass, and every adjacent coefficient through order 300.

The program starts with the coefficient vector `[1]` and applies the exact recurrence \[ a_n(j)=a_{n-1}(j)+a_{n-1}(j-n)+a_{n-1}(j-2n), \] with out-of-range terms set to zero. At every order it checks reciprocity, verifies that the coefficient sum is \(3^n\), and scans every adjacent pair through the center.

The failure set through 300 is exactly \(\{2,4,6,8,9,10\}\). At every order from 11 through 300 the only equal adjacent pairs before the center occur at exponents 0 and 2. The complete coefficient vectors at \(n=11,100,300\), serialized as compact JSON, have SHA-256 digests `4e87e46d97a8dba7cb176b5437b873de075b81464036efa1e846ed25c99fd74f`, `9c1d89fd72812e83cbacbfe57bfb9ffe9ea618e52b6e0cca079ea16025d6ec0c`, and `6a588b1ee8f54446ea03a2abe977271047d2c84c30c956bf28f5ed20d50f4177`.

Reproduced evidence. Recorded scope: every polynomial order from 1 through 300.

2Reproduce

Replay: partial

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

Entry point
join source_lines with newline and run with python3
Runtime
CPython 3, standard library only

Verification source: doi.org ↗, Inline CPython 3 source below, executed on 2026-07-24

Missing for a complete replay: command, expected output.

3Source code

View source code
Source code
from hashlib import sha256
from json import dumps
N=300
coeff=[1]
failures=[]
checkpoints={}
expected_hashes={
 11:'4e87e46d97a8dba7cb176b5437b873de075b81464036efa1e846ed25c99fd74f',
 100:'9c1d89fd72812e83cbacbfe57bfb9ffe9ea618e52b6e0cca079ea16025d6ec0c',
 300:'6a588b1ee8f54446ea03a2abe977271047d2c84c30c956bf28f5ed20d50f4177',
}
for n in range(1,N+1):
    nxt=[0]*(len(coeff)+2*n)
    for j,value in enumerate(coeff):
        nxt[j]+=value
        nxt[j+n]+=value
        nxt[j+2*n]+=value
    coeff=nxt
    assert coeff==coeff[::-1]
    assert sum(coeff)==3**n
    middle=n*(n+1)//2
    descents=[j for j in range(middle) if coeff[j]>coeff[j+1]]
    zero_differences=[j for j in range(middle) if coeff[j]==coeff[j+1]]
    if descents:
        failures.append(n)
    if n>=11:
        assert zero_differences==[0,2]
    if n in (10,11,100,300):
        checkpoints[n]={
            'degree':len(coeff)-1,
            'center':coeff[middle],
            'center_minus_previous':coeff[middle]-coeff[middle-1],
            'window':coeff[middle-5:middle+6],
            'zero_differences':zero_differences,
            'descents':descents,
            'sha256':sha256(dumps(coeff,separators=(',',':')).encode()).hexdigest(),
        }
assert failures==[2,4,6,8,9,10]
assert checkpoints[10]['window']==[1367,1379,1404,1408,1423,1417,1423,1408,1404,1379,1367]
assert checkpoints[11]['window']==[3608,3657,3684,3715,3723,3735,3723,3715,3684,3657,3608]
for n,digest in expected_hashes.items():
    assert checkpoints[n]['sha256']==digest
print('orders 1..300')
print('failures',','.join(map(str,failures)))
for n in (10,11,100,300):
    c=checkpoints[n]
    print(n,c['degree'],c['center'],c['center_minus_previous'],c['zero_differences'],c['descents'],c['sha256'])

4What it produced

Expected stdout sha256
8f04763ec3de4cb710ddfaadc8abead82219b7f83e3c1bf60ba3c52a61b6144f

5How it connects

Evidence for

Recorded for

6Agent packet

A compact handoff with the evidence boundary, replay manifest, and relation pointers.

View structured packet
json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R807",
  "content_hash": null,
  "slug": "tspu-artifact-sweep-300",
  "type": "artifact",
  "title": "Exact coefficient sweep through n = 300",
  "summary": "Standard-library Python checks symmetry, total mass, and every adjacent coefficient through order 300.",
  "relevance": "For Eventual unimodality of ternary subset-sum polynomials, record tspu-artifact-sweep-300 (“Exact coefficient sweep through n = 300”) supplies evidence or a replay used to check the packet. The record states: Standard-library Python checks symmetry, total mass, and every adjacent coefficient through order 300.",
  "relevance_source": "recorded",
  "body": "The program starts with the coefficient vector `[1]` and applies the exact recurrence\n\\[\na_n(j)=a_{n-1}(j)+a_{n-1}(j-n)+a_{n-1}(j-2n),\n\\]\nwith out-of-range terms set to zero. At every order it checks reciprocity, verifies that the coefficient sum is \\(3^n\\), and scans every adjacent pair through the center.\n\nThe failure set through 300 is exactly \\(\\{2,4,6,8,9,10\\}\\). At every order from 11 through 300 the only equal adjacent pairs before the center occur at exponents 0 and 2. The complete coefficient vectors at \\(n=11,100,300\\), serialized as compact JSON, have SHA-256 digests `4e87e46d97a8dba7cb176b5437b873de075b81464036efa1e846ed25c99fd74f`, `9c1d89fd72812e83cbacbfe57bfb9ffe9ea618e52b6e0cca079ea16025d6ec0c`, and `6a588b1ee8f54446ea03a2abe977271047d2c84c30c956bf28f5ed20d50f4177`.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "every polynomial order from 1 through 300",
    "bounds": {
      "n": {
        "min": 1,
        "max": 300
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "partial",
    "kind": "inline_python_computation",
    "entrypoint": "join source_lines with newline and run with python3",
    "runtime": "CPython 3, standard library only",
    "citation": {
      "url": "https://doi.org/10.1016/0022-314X(89)90096-6",
      "locator": "Inline CPython 3 source below, executed on 2026-07-24"
    },
    "inline_source": [
      "from hashlib import sha256",
      "from json import dumps",
      "N=300",
      "coeff=[1]",
      "failures=[]",
      "checkpoints={}",
      "expected_hashes={",
      " 11:'4e87e46d97a8dba7cb176b5437b873de075b81464036efa1e846ed25c99fd74f',",
      " 100:'9c1d89fd72812e83cbacbfe57bfb9ffe9ea618e52b6e0cca079ea16025d6ec0c',",
      " 300:'6a588b1ee8f54446ea03a2abe977271047d2c84c30c956bf28f5ed20d50f4177',",
      "}",
      "for n in range(1,N+1):",
      "    nxt=[0]*(len(coeff)+2*n)",
      "    for j,value in enumerate(coeff):",
      "        nxt[j]+=value",
      "        nxt[j+n]+=value",
      "        nxt[j+2*n]+=value",
      "    coeff=nxt",
      "    assert coeff==coeff[::-1]",
      "    assert sum(coeff)==3**n",
      "    middle=n*(n+1)//2",
      "    descents=[j for j in range(middle) if coeff[j]>coeff[j+1]]",
      "    zero_differences=[j for j in range(middle) if coeff[j]==coeff[j+1]]",
      "    if descents:",
      "        failures.append(n)",
      "    if n>=11:",
      "        assert zero_differences==[0,2]",
      "    if n in (10,11,100,300):",
      "        checkpoints[n]={",
      "            'degree':len(coeff)-1,",
      "            'center':coeff[middle],",
      "            'center_minus_previous':coeff[middle]-coeff[middle-1],",
      "            'window':coeff[middle-5:middle+6],",
      "            'zero_differences':zero_differences,",
      "            'descents':descents,",
      "            'sha256':sha256(dumps(coeff,separators=(',',':')).encode()).hexdigest(),",
      "        }",
      "assert failures==[2,4,6,8,9,10]",
      "assert checkpoints[10]['window']==[1367,1379,1404,1408,1423,1417,1423,1408,1404,1379,1367]",
      "assert checkpoints[11]['window']==[3608,3657,3684,3715,3723,3735,3723,3715,3684,3657,3608]",
      "for n,digest in expected_hashes.items():",
      "    assert checkpoints[n]['sha256']==digest",
      "print('orders 1..300')",
      "print('failures',','.join(map(str,failures)))",
      "for n in (10,11,100,300):",
      "    c=checkpoints[n]",
      "    print(n,c['degree'],c['center'],c['center_minus_previous'],c['zero_differences'],c['descents'],c['sha256'])"
    ],
    "missing": [
      "command",
      "expected_output"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": "https://doi.org/10.1016/0022-314X(89)90096-6",
    "locator": "Inline CPython 3 source below, executed on 2026-07-24"
  },
  "relations": [
    {
      "slug": "R809",
      "title": "The complete failure set is 2, 4, 6, 8, 9, and 10",
      "object_type": "claim",
      "relation": "evidences",
      "direction": "outgoing"
    },
    {
      "slug": "R808",
      "title": "Almkvist's theorem settles every n at least 11",
      "object_type": "claim",
      "relation": "tests",
      "direction": "outgoing"
    },
    {
      "slug": "ternary-subset-polynomial-unimodality",
      "title": "ternary subset polynomial unimodality",
      "object_type": "problem",
      "relation": "recorded_for",
      "direction": "outgoing"
    }
  ]
}

7Provenance

View source, identifiers, and projection details
Project
ternary-subset-polynomial-unimodality
Locator
Inline CPython 3 source below, executed on 2026-07-24
License
CC0-1.0
Contributors
TheoremDB entry research, 2026-07-24
Public record
R807
Stable alias
tspu-artifact-sweep-300
Projection
Reproduction fields are derived from the immutable record.

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

Report a problem

Your ChatGPT account

Opening ChatGPT

ChatGPT is opening in a new tab.