Catalog/gt-integer-partitions

Game Theory

Integer partitions API

Counts the partitions p(n) of an integer into unordered positive summands, optionally bounded by max number of parts or max part size, via exact DP. Answers 'How many ways can 10 be written as a sum of positive integers?', 'p(n) with parts at most k?'.

Price$0.04per request
MethodPOST
Route/v1/gametheory/integer-partitions
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
combinatoricspartitionsnumber-theoryp-of-ncountingdynamic-programmingdiscretesummands
API URLhttps://x402.hexl.dev/v1/gametheory/integer-partitions
Integration docs
Example request
{
  "n": 10
}
Example response
{
  "n": 10,
  "partitions": 42,
  "partitionsExact": "42",
  "isExactInteger": true,
  "restriction": "none",
  "interpretation": "p(10) = 42: the number of ways to write 10 as an unordered sum of positive integers."
}
Input schema
{
  "type": "object",
  "required": [
    "n"
  ],
  "properties": {
    "n": {
      "type": "integer",
      "minimum": 0,
      "maximum": 400,
      "examples": [
        10
      ]
    },
    "maxParts": {
      "type": "integer",
      "minimum": 1
    },
    "maxPartSize": {
      "type": "integer",
      "minimum": 1,
      "examples": [
        3
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}