{"openapi":"3.1.0","info":{"title":"Number Representations API","version":"1.0.0","description":"Convert integers and numbers into the special number representations that ordinary base conversion leaves out — and back again. The graycode endpoint converts between an integer and its reflected binary Gray code, where consecutive values differ by exactly one bit (used in rotary encoders, Karnaugh maps and error reduction). The balanced-ternary endpoint converts between an integer and balanced ternary, the base-3 system with digits −1, 0 and +1 (written T, 0, 1) that needs no separate sign. The factoradic endpoint converts between an integer and the factorial number system (mixed radix 1, 2, 3, …), the basis of permutation ranking and Lehmer codes. The continued-fraction endpoint turns a fraction or a real number into its continued-fraction expansion [a0; a1, a2, …] and lists the convergents — the successively best rational approximations — and can rebuild the value from the terms. All integer maths is exact via big integers. Everything is computed locally and deterministically, so it is instant and private. Ideal for computer-science teaching, combinatorics and permutation ranking, error-correcting and encoder design, rational approximation, and recreational mathematics. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 5 endpoints. This handles special number representations; for ordinary base 2-36 conversion use a base-convert API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/numrep-api","description":"oanor gateway"}],"tags":[{"name":"Numbers"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/balanced-ternary":{"get":{"operationId":"get_v1_balanced_ternary","tags":["Numbers"],"summary":"Balanced ternary","description":"","parameters":[{"name":"n","in":"query","required":false,"description":"Integer to encode","schema":{"type":"string"},"example":"5"},{"name":"bt","in":"query","required":false,"description":"Or balanced-ternary (1,0,T) to decode","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"input":{"n":"5"},"decimal":"5","digits_note":"T means -1","balanced_ternary":"1TT"},"meta":{"timestamp":"2026-06-03T17:42:13.746Z","request_id":"3c3bb68f-dc1d-4f66-bf7a-739d2be69e7c"},"status":"ok","message":"Balanced ternary","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/continued-fraction":{"get":{"operationId":"get_v1_continued_fraction","tags":["Numbers"],"summary":"Continued fraction","description":"","parameters":[{"name":"fraction","in":"query","required":false,"description":"p/q","schema":{"type":"string"},"example":"415/93"},{"name":"value","in":"query","required":false,"description":"Or a real number","schema":{"type":"string"}},{"name":"terms","in":"query","required":false,"description":"Or [a0,a1,...] to rebuild","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"input":{"numerator":"415","denominator":"93"},"terms":[4,2,6,7],"reduced":"415/93","convergents":[{"den":"1","num":"4","value":4},{"den":"2","num":"9","value":4.5},{"den":"13","num":"58","value":4.461538461538462},{"den":"93","num":"415","value":4.462365591397849}]},"meta":{"timestamp":"2026-06-03T17:42:13.839Z","request_id":"1dee780e-b335-40e9-8260-8612b99c8ba3"},"status":"ok","message":"Continued fraction","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/factoradic":{"get":{"operationId":"get_v1_factoradic","tags":["Numbers"],"summary":"Factorial base","description":"","parameters":[{"name":"n","in":"query","required":false,"description":"Integer to encode","schema":{"type":"string"},"example":"463"},{"name":"factoradic","in":"query","required":false,"description":"Or factoradic digits to decode","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"rightmost digit is the 0!-place (always 0)","input":{"n":"463"},"decimal":"463","factoradic":"341010"},"meta":{"timestamp":"2026-06-03T17:42:13.948Z","request_id":"e6c66dae-56ad-4571-83e0-04314e06d577"},"status":"ok","message":"Factoradic","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/graycode":{"get":{"operationId":"get_v1_graycode","tags":["Numbers"],"summary":"Gray code encode/decode","description":"","parameters":[{"name":"n","in":"query","required":false,"description":"Integer to encode","schema":{"type":"string"},"example":"5"},{"name":"gray","in":"query","required":false,"description":"Or Gray-code binary to decode","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"input":{"n":"5"},"binary":"101","decimal":"5","gray_code":"111"},"meta":{"timestamp":"2026-06-03T17:42:14.042Z","request_id":"0b3eabfe-301e-44bd-a2a8-9772d02e6601"},"status":"ok","message":"Gray code","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"name":"Number Representations API","notes":"Gray/balanced-ternary/factoradic are exact via big integers. A real value's continued fraction is approximate with a bounded number of terms. Nothing is stored.","version":"v1","endpoints":[{"path":"/v1/graycode","params":{"n":"a non-negative integer to encode","gray":"or a Gray-code binary string to decode"},"returns":"the Gray code and the plain binary/decimal"},{"path":"/v1/balanced-ternary","params":{"n":"an integer to encode","bt":"or a balanced-ternary string (1,0,T) to decode"},"returns":"the balanced-ternary form (T = -1)"},{"path":"/v1/factoradic","params":{"n":"a non-negative integer to encode","factoradic":"or a factoradic digit string to decode"},"returns":"the factorial-base form"},{"path":"/v1/continued-fraction","params":{"terms":"[a0,a1,...] to rebuild","value":"a real number","fraction":"p/q","numerator":"& denominator"},"returns":"the continued-fraction terms and convergents"},{"path":"/v1/meta","params":[],"returns":"this document"}],"description":"Convert integers and numbers into the special number representations that ordinary base conversion leaves out — and back again. The graycode endpoint converts between an integer and its reflected binary Gray code (where consecutive values differ by exactly one bit — used in rotary encoders, Karnaugh maps and error reduction). The balanced-ternary endpoint converts between an integer and balanced ternary, the base-3 system with digits −1, 0 and +1 (written T, 0, 1) that needs no separate sign. The factoradic endpoint converts between an integer and the factorial number system (mixed radix 1,2,3,…), the basis of permutation ranking and Lehmer codes. The continued-fraction endpoint turns a fraction or a real number into its continued-fraction expansion [a0; a1, a2, …] and lists the convergents — the best rational approximations — and can rebuild the value from the terms. All integer maths is exact via big integers. Everything is computed locally and deterministically, so it is instant and private. Ideal for computer-science teaching, combinatorics and permutation ranking, error-correcting and encoder design, rational approximation, and recreational maths. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 5 endpoints. This handles special number representations; for ordinary base 2-36 conversion use a base-convert API."},"meta":{"timestamp":"2026-06-03T17:42:14.135Z","request_id":"8c3fc08b-2570-4701-914c-6f29ec28aab7"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":6335,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":785,"monthly_call_quota":15850,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2775,"monthly_call_quota":209500,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":6575,"monthly_call_quota":1090000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/numrep-api"}