{"openapi":"3.1.0","info":{"title":"Combinatorics","version":"0.1.0","description":"Exact combinatorial counting on arbitrary-precision integers — factorials, permutations (nPr), combinations (nCr), multinomial coefficients and Catalan numbers.","x-guidance":"Exact combinatorial counting on arbitrary-precision integers — factorials, permutations (nPr), combinations (nCr), multinomial coefficients and Catalan numbers. Each operation is an HTTP POST to its /v1/<operation> path with a JSON request body (see each operation's requestBody schema) and returns a JSON response. Endpoints are paid per successful call via x402 or MPP (USDC on Base); an unpaid request returns 402 with payment metadata in the WWW-Authenticate header.","contact":{"email":"hello@openverbs.com"}},"x-discovery":{"ownershipProofs":["0xb1401a71756f51464a9962db12f1eb3e9522490cd20010b06d00cf7b7770acfd5f79721f9dfdf2643f8cecd29af3bde9ec133941a386042b32d9886053a70de61b","0xc1c1f11793e18a00fcb7072421f26e89fb75b6aa517fa84370564991f4b10efa024f6f57e4e67eefd20cf46cc01fc5a62d793fa8fbcda04f26c946a3433d73f91b","0x676b474af0ef9ed4809b5d12d2e789b36e52d56215b21f601d71f76620e36ec630347116a7b2b349a3c3681e5db0fbfa76c4169a676b6d6f27864d0e5017284a1c","0xc2ab96522515ed9e9bc4f1a241b774bd48df42e951ddbf7f6aa8fc76f5a96a20421703e1ec402ce7eb1e4eabea3b6e4e4129cf39d56ea91cf4fcf38561fc94fc1c"]},"servers":[{"url":"https://combinatorics.openverbs.com"}],"paths":{"/health":{"get":{"summary":"Health check","security":[],"responses":{"200":{"description":"Healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"service":{"type":"string"},"version":{"type":"string"}}}}}}}}},"/v1/factorial":{"post":{"summary":"Factorial","description":"Exact factorial n! for 0 ≤ n ≤ 20000, returned as a decimal string with its digit count. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["factorial api","compute factorial","n factorial","exact factorial","bigint factorial","factorial digit count"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Non-negative integer ≤ 20000."}},"required":["n"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result, digits }` (result is an exact decimal string).","content":{"application/json":{"schema":{"type":"object","description":"`{ result, digits }` (result is an exact decimal string)."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Exact factorial n! for 0 ≤ n ≤ 20000, returned as a decimal string with its digit count.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Exact factorial n! for 0 ≤ n ≤ 20000, returned as a decimal string with its digit count.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Exact factorial n! for 0 ≤ n ≤ 20000, returned as a decimal string with its digit count.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/permutations":{"post":{"summary":"Permutations (nPr)","description":"Number of ordered arrangements of r items from n, nPr = n!/(n-r)!. Requires r ≤ n and r ≤ 10000. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["permutations npr","compute permutations","ordered arrangements","npr api","permutation count","arrangements without replacement"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Non-negative integer ≤ 1000000."},"r":{"type":"string","pattern":"^\\d+$","description":"Non-negative integer, r ≤ n."}},"required":["n","r"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result, digits }` (result is an exact decimal string).","content":{"application/json":{"schema":{"type":"object","description":"`{ result, digits }` (result is an exact decimal string)."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Number of ordered arrangements of r items from n, nPr = n!/(n-r)!. Requires r ≤ n and r ≤ 10000.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Number of ordered arrangements of r items from n, nPr = n!/(n-r)!. Requires r ≤ n and r ≤ 10000.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Number of ordered arrangements of r items from n, nPr = n!/(n-r)!. Requires r ≤ n and r ≤ 10000.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/combinations":{"post":{"summary":"Combinations (nCr)","description":"Binomial coefficient nCr = n!/(r!(n-r)!), the number of unordered r-subsets of n. Requires r ≤ n and min(r, n-r) ≤ 10000. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["combinations ncr","compute combinations","binomial coefficient","ncr api","choose r from n","combination count"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Non-negative integer ≤ 1000000."},"r":{"type":"string","pattern":"^\\d+$","description":"Non-negative integer, r ≤ n."}},"required":["n","r"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result, digits }` (result is an exact decimal string).","content":{"application/json":{"schema":{"type":"object","description":"`{ result, digits }` (result is an exact decimal string)."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Binomial coefficient nCr = n!/(r!(n-r)!), the number of unordered r-subsets of n. Requires r ≤ n and min(r, n-r) ≤ 10000.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Binomial coefficient nCr = n!/(r!(n-r)!), the number of unordered r-subsets of n. Requires r ≤ n and min(r, n-r) ≤ 10000.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Binomial coefficient nCr = n!/(r!(n-r)!), the number of unordered r-subsets of n. Requires r ≤ n and min(r, n-r) ≤ 10000.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/multinomial":{"post":{"summary":"Multinomial coefficient","description":"Multinomial coefficient (k1+k2+…)! / (k1! k2! …) — the number of ways to partition n = Σki items into labelled groups of the given sizes. The sum must be ≤ 20000. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["multinomial coefficient","compute multinomial","partition items into groups","labelled group count","multinomial api","group arrangement count"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","minItems":1,"maxItems":256,"items":{"type":"string","pattern":"^\\d+$"},"description":"Group sizes as decimal strings; their sum must be ≤ 20000."}},"required":["groups"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result, n, digits }`.","content":{"application/json":{"schema":{"type":"object","description":"`{ result, n, digits }`."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Multinomial coefficient (k1+k2+…)! / (k1! k2! …) — the number of ways to partition n = Σki items into labelled groups of the given sizes. The sum must be ≤ 20000.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Multinomial coefficient (k1+k2+…)! / (k1! k2! …) — the number of ways to partition n = Σki items into labelled groups of the given sizes. The sum must be ≤ 20000.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Multinomial coefficient (k1+k2+…)! / (k1! k2! …) — the number of ways to partition n = Σki items into labelled groups of the given sizes. The sum must be ≤ 20000.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/catalan":{"post":{"summary":"Catalan number","description":"The n-th Catalan number Cₙ = C(2n, n)/(n+1), counting balanced bracketings, binary trees, and many other structures. Requires n ≤ 10000. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["catalan number","compute catalan","balanced bracket count","binary tree count","catalan api","combinatorics sequence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Non-negative integer ≤ 10000."}},"required":["n"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result, digits }` (result is an exact decimal string).","content":{"application/json":{"schema":{"type":"object","description":"`{ result, digits }` (result is an exact decimal string)."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"The n-th Catalan number Cₙ = C(2n, n)/(n+1), counting balanced bracketings, binary trees, and many other structures. Requires n ≤ 10000.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"The n-th Catalan number Cₙ = C(2n, n)/(n+1), counting balanced bracketings, binary trees, and many other structures. Requires n ≤ 10000.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"The n-th Catalan number Cₙ = C(2n, n)/(n+1), counting balanced bracketings, binary trees, and many other structures. Requires n ≤ 10000.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}}},"x-service-info":{"categories":["compute"],"docs":{"homepage":"https://combinatorics.openverbs.com","apiReference":"https://combinatorics.openverbs.com/openapi.json"}}}