2018-09-30 23:01:58 +01:00
|
|
|
|
---
|
|
|
|
|
id: 5900f53e1000cf542c510051
|
|
|
|
|
title: 'Problem 466: Distinct terms in a multiplication table'
|
2020-11-27 19:02:05 +01:00
|
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
|
forumTopicId: 302141
|
2021-01-13 03:31:00 +01:00
|
|
|
|
dashedName: problem-466-distinct-terms-in-a-multiplication-table
|
2018-09-30 23:01:58 +01:00
|
|
|
|
---
|
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
|
# --description--
|
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
|
Let $P(m,n)$ be the number of distinct terms in an $m×n$ multiplication table.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
|
|
For example, a 3×4 multiplication table looks like this:
|
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
|
$$\begin{array}{c}
|
|
|
|
|
× & \mathbf{1} & \mathbf{2} & \mathbf{3} & \mathbf{4} \\\\
|
|
|
|
|
\mathbf{1} & 1 & 2 & 3 & 4 \\\\
|
|
|
|
|
\mathbf{2} & 2 & 4 & 6 & 8 \\\\
|
|
|
|
|
\mathbf{3} & 3 & 6 & 9 & 12
|
|
|
|
|
\end{array}$$
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
|
There are 8 distinct terms {1, 2, 3, 4, 6, 8, 9, 12}, therefore $P(3, 4) = 8$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
|
You are given that:
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
|
$$\begin{align}
|
|
|
|
|
& P(64, 64) = 1\\,263, \\\\
|
|
|
|
|
& P(12, 345) = 1\\,998, \text{ and} \\\\
|
|
|
|
|
& P(32, {10}^{15}) = 13\\,826\\,382\\,602\\,124\\,302. \\\\
|
|
|
|
|
\end{align}$$
|
|
|
|
|
|
|
|
|
|
Find $P(64, {10}^{16})$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
|
# --hints--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
|
`multiplicationTable()` should return `258381958195474750`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
|
```js
|
2021-07-30 17:32:21 +02:00
|
|
|
|
assert.strictEqual(multiplicationTable(), 258381958195474750);
|
2018-09-30 23:01:58 +01:00
|
|
|
|
```
|
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
|
# --seed--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
|
## --seed-contents--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
|
|
```js
|
2021-07-30 17:32:21 +02:00
|
|
|
|
function multiplicationTable() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
|
multiplicationTable();
|
2018-09-30 23:01:58 +01:00
|
|
|
|
```
|
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
|
# --solutions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|