Challenge
#Challenge
YouYou must write a program that takes a positive integer n
as input, and outputs the n
th Fibonacci number (shortened as Fib# throughout) that contains the n
th Fib# as a subtring. For the purposes of this challenge, the Fibonacci sequence begins with a 1
.
Here are some examples that you can use as test cases, or as examples to clarify the challenge (for the latter, please leave a comment down below explaining what you find unclear).
n=1
Fib#s: 1
^1 1st Fib# that contains a 1 (1st Fib#)
Output: 1
n=2
Fib#s: 1, 1
^1 ^2 2nd Fib# that contains a 1 (2nd Fib#)
Output: 1
n=3
Fib#s: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233
^1 ^2 ^3 3rd Fib# that contains a 2 (3rd Fib#)
Output: 233
n=4
Output: 233
n=5
Output: 6765
n=6
Output: 28657
n=7
Output: 1304969544928657
n=8
Output: 14472334024676221
n=9
Output: 23416728348467685
n=10
Fib#s: 1, ..., 34, 55, 89, ..., 63245986, 102334155, 165580141, ..., 2880067194370816120, 4660046610375530309
^1 ^2 ^3 ^10 10th Fib# that contains a 55 (10th Fib#)
Output: 4660046610375530309
As always, this is code-golf, so go for the lowest byte count possible.
If something is confusing/unclear, please leave a comment.
(This challenge is based off another challenge I posted: Print the nth prime that contains n)