2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f4791000cf542c50ff8c
|
|
|
|
title: 'Problem 269: Polynomials with at least one integer root'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 301918
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-269-polynomials-with-at-least-one-integer-root
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
A root or zero of a polynomial $P(x)$ is a solution to the equation $P(x) = 0$.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
Define $P_n$ as the polynomial whose coefficients are the digits of $n$.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
For example, $P_{5703}(x) = 5x^3 + 7x^2 + 3$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
We can see that:
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
- $P_n(0)$ is the last digit of $n$,
|
|
|
|
- $P_n(1)$ is the sum of the digits of $n$,
|
|
|
|
- $Pn(10)$ is $n$ itself.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
Define $Z(k)$ as the number of positive integers, $n$, not exceeding $k$ for which the polynomial $P_n$ has at least one integer root.
|
|
|
|
|
|
|
|
It can be verified that $Z(100\\,000)$ is 14696.
|
|
|
|
|
|
|
|
What is $Z({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-24 09:09:54 +02:00
|
|
|
`polynomialsWithOneIntegerRoot()` should return `1311109198529286`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-24 09:09:54 +02:00
|
|
|
assert.strictEqual(polynomialsWithOneIntegerRoot(), 1311109198529286);
|
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-24 09:09:54 +02:00
|
|
|
function polynomialsWithOneIntegerRoot() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
polynomialsWithOneIntegerRoot();
|
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
|
|
|
|
```
|