2018-09-30 22:01:58 +00:00
---
id: 5900f3d51000cf542c50fee6
title: 'Problem 104: Pandigital Fibonacci ends'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301728
2021-01-13 02:31:00 +00:00
dashedName: problem-104-pandigital-fibonacci-ends
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
The Fibonacci sequence is defined by the recurrence relation:
2020-11-27 18:02:05 +00:00
2021-06-30 12:25:46 +00:00
$F_n = F_{n − 1} + F_{n − 2}$, where $F_1 = 1$ and $F_2 = 1$
2018-09-30 22:01:58 +00:00
2021-06-30 12:25:46 +00:00
It turns out that $F_{541}$, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1 - 9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And $F_{2749}$, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1 - 9 pandigital.
2018-09-30 22:01:58 +00:00
2021-06-30 12:25:46 +00:00
Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are 1 - 9 pandigital, find `k` .
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-06-30 12:25:46 +00:00
`pandigitalFibonacciEnds()` should return `329468` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-06-30 12:25:46 +00:00
assert.strictEqual(pandigitalFibonacciEnds(), 329468);
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-06-30 12:25:46 +00:00
function pandigitalFibonacciEnds() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-06-30 12:25:46 +00:00
pandigitalFibonacciEnds();
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
```