2018-09-30 22:01:58 +00:00
---
id: 5900f5311000cf542c510044
title: 'Problem 453: Lattice Quadrilaterals'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 302126
2021-01-13 02:31:00 +00:00
dashedName: problem-453-lattice-quadrilaterals
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
A simple quadrilateral is a polygon that has four distinct vertices, has no straight angles and does not self-intersect.
2021-07-30 15:20:31 +00:00
Let $Q(m, n)$ be the number of simple quadrilaterals whose vertices are lattice points with coordinates ($x$, $y$) satisfying $0 ≤ x ≤ m$ and $0 ≤ y ≤ n$.
2018-09-30 22:01:58 +00:00
2021-07-30 15:20:31 +00:00
For example, $Q(2, 2) = 94$ as can be seen below:
2018-09-30 22:01:58 +00:00
2021-07-30 15:20:31 +00:00
< img class = "img-responsive center-block" alt = "94 quadrilaterals whose vertices are lattice points with coordinates (x, y) satiffying 0 ≤ x ≤ m and 0 ≤ y ≤ n" src = "https://cdn.freecodecamp.org/curriculum/project-euler/lattice-quadrilaterals.png" style = "background-color: white; padding: 10px;" >
2018-09-30 22:01:58 +00:00
2021-07-30 15:20:31 +00:00
It can also be verified that $Q(3, 7) = 39\\,590$, $Q(12, 3) = 309\\,000$ and $Q(123, 45) = 70\\,542\\,215\\,894\\,646$.
Find $Q(12\\,345, 6\\,789)\bmod 135\\,707\\,531$.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-30 15:20:31 +00:00
`latticeQuadrilaterals()` should return `104354107` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-30 15:20:31 +00:00
assert.strictEqual(latticeQuadrilaterals(), 104354107);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-30 15:20:31 +00:00
function latticeQuadrilaterals() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-30 15:20:31 +00:00
latticeQuadrilaterals();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```