Consider a sequence based on recurrence relations, f(n) = f(n-1)+f(n-2)
, starting with f(1) = x1, f(2) = x2
. For x1 = 2, x2 = 1
, the sequence begins like this:
2 1 3 4 7 11 18 29 47 76 123 199 322 521 843
Concatenating this into a string will give:
213471118294776123199322521843
Now, divide this list into the smallest possible numbers that gives y(n) > y(n-1)
. Start with the first number, then the second etc. The first output number should always be a single digit. Pad the last number with the required number of zeros.
2 13 47 111 829 4776 12319 93225 218430
You will get two numbers, (x1, x2)
as input, on any convenient format, and the challenge is to output the sorted list.
Rules:
- Function and programs are OK
- The initial sequence shall have exactly 15 numbers (The last number is
f(15)
). x1
andx2
are non-negative (zero is possible).- The output can be on any convenient format
- The output vector
y
must be created so thaty2 > y1
.- First the smallest possible
y1
, then the smallest possibley2
, theny3
and so on.
- First the smallest possible
- If
x1 = x2 = 0
then output 15 zeros (on the same format as other output, i.e. not000000000000000
).
Examples:
Input: 1 1
Output: 1 12 35 81 321 345 589 1442 3337 7610
Input: 3 2
Output: 3 25 71 219 315 0811 3121 23435 55898 145300
|
Optional leading zero
Input: 0 0
Output: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The shortest code in bytes wins. Please include a link to an online interpreter if possible.
5467
be?54 67
?5 46 70
? \$\endgroup\$