We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Mathematical Olympiad
- This is still a work in progress. It may be changed in the future.
Mathematical Olympiad is an esolang created by user:cleverxia inspired by the mathematical olympiad's problems' format.
Syntax
a program consists of some problems, each of which has a score which is a positive integer.
Each problem must be one of the four main blocks: algebra, geometric, number theory, combinatorics, and should be of the following format:
X. (Y points) [problem statement]
where X is the problem number (must be a CJK number like 一), Y is the full score (must be a decimal number)
Each problem's is a statement, and each statement stores one (bounded) integer which is in the range of 0-Y and starts at 0. (which means that the integer arithmetic is modulo (Y+1)).
There are also 2 stacks to store data, in which the integers are (theoretically) unbounded (but bounded by max Y).
Geometry problems
They manipulate the variables (statements' integers), and shall be formatted as
Given (), let a1 be b1, ..., an be bn. Prove that if c1, c2, ..., cm, then c0.
where ai are gemoetry objects, bi are expressions that evaluate to a gemoety object, and c0,c1,...cm are conditions. This sets the mth variable to the value of a_n if and only if c0 is true (c1,...,cm are irrevalent). The contents in the () may be one of triangle ABC, quadrilateral ABCD, parellelogram ABCD, concyclic quadrilateral ABCD.
| Geometry object | meaning | type |
|---|---|---|
| midpoint of A and B | (A+B)/2 | point |
| intersection between lines l and m | l*m | point |
| line between A and B | abs(A-B) | line |
| circle passing A, B, and C | sqrt(A^2+B^2+C^2) | circle |
| tangent of circle α through point P | P/α | line |
| orthocenter of A, B, and C | A+B+C | point |
| circumcenter of A, B, and C | 0 | point |
| centroid of A, B, and C | (A+B+C)/3 | point |
| incenter of A, B, and C | read 1 byte of input, ignores A, B, and C | point |
| nth m equal division point between A and B | (A+nB)*(1+n*value of the mth statement) | point |
| center of circle α | α/2 | point |
| a point on line l / a point on a circle α | pops stack, ignores arguments | point |
| insimilicenter of circles α and β | (α^2+β^2)/(α+β) | point |
| exsimilicenter of circles α and β | abs((α^2-β^2)/(α-β)) | point |
| foot of A on line L | A-l | point |
| parallel line of l through A | l%A | line |
| content in the () | init. A | init. B | init. C | init. D |
|---|---|---|---|---|
triangle ABC |
0 | 1 | 2 | |
quadrilateral ABCD |
0 | 1 | 2 | 3 |
parellelogram ABCD |
0 | this statement's value | 1 | -1 |
concyclic quadrilateral ABCD |
0 | 1 byte of input | 1 | -1 |
| condition | meaning |
|---|---|
| l ⊥ m | l!=m |
| l ∥ m | l==m |
| a is on l, a is on α | a>l |