RosettaCodeData/Task/Fibonacci-n-step-number-sequences/00-TASK.txt
2023-07-01 13:44:08 -04:00

60 lines
3.4 KiB
Text
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

These number series are an expansion of the ordinary [[Fibonacci sequence]] where:
# For <math>n = 2</math> we have the Fibonacci sequence; with initial values <math>[1, 1]</math> and <math>F_k^2 = F_{k-1}^2 + F_{k-2}^2</math>
# For <math>n = 3</math> we have the tribonacci sequence; with initial values <math>[1, 1, 2]</math> and <math>F_k^3 = F_{k-1}^3 + F_{k-2}^3 + F_{k-3}^3</math>
# For <math>n = 4</math> we have the tetranacci sequence; with initial values <math>[1, 1, 2, 4]</math> and <math>F_k^4 = F_{k-1}^4 + F_{k-2}^4 + F_{k-3}^4 + F_{k-4}^4</math><br>...
# For general <math>n>2</math> we have the Fibonacci <math>n</math>-step sequence - <math>F_k^n</math>; with initial values of the first <math>n</math> values of the <math>(n-1)</math>'th Fibonacci <math>n</math>-step sequence <math>F_k^{n-1}</math>; and <math>k</math>'th value of this <math>n</math>'th sequence being <math>F_k^n = \sum_{i=1}^{(n)} {F_{k-i}^{(n)}}</math>
For small values of <math>n</math>, [[wp:Number prefix#Greek_series|Greek numeric prefixes]] are sometimes used to individually name each series.
:::: {| style="text-align: left;" border="4" cellpadding="2" cellspacing="2"
|+ Fibonacci <math>n</math>-step sequences
|- style="background-color: rgb(255, 204, 255);"
! <math>n</math> !! Series name !! Values
|-
| 2 || fibonacci || 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 ...
|-
| 3 || tribonacci || 1 1 2 4 7 13 24 44 81 149 274 504 927 1705 3136 ...
|-
| 4 || tetranacci || 1 1 2 4 8 15 29 56 108 208 401 773 1490 2872 5536 ...
|-
| 5 || pentanacci || 1 1 2 4 8 16 31 61 120 236 464 912 1793 3525 6930 ...
|-
| 6 || hexanacci || 1 1 2 4 8 16 32 63 125 248 492 976 1936 3840 7617 ...
|-
| 7 || heptanacci || 1 1 2 4 8 16 32 64 127 253 504 1004 2000 3984 7936 ...
|-
| 8 || octonacci || 1 1 2 4 8 16 32 64 128 255 509 1016 2028 4048 8080 ...
|-
| 9 || nonanacci || 1 1 2 4 8 16 32 64 128 256 511 1021 2040 4076 8144 ...
|-
| 10 || decanacci || 1 1 2 4 8 16 32 64 128 256 512 1023 2045 4088 8172 ...
|}
Allied sequences can be generated where the initial values are changed:
: '''The [[wp:Lucas number|Lucas series]]''' sums the two preceding values like the fibonacci series for <math>n=2</math> but uses <math>[2, 1]</math> as its initial values.
<!-- Lucas numbers, Lucas number, Lucas series [added to make searches easier.] -->
<br>
;Task:
# Write a function to generate Fibonacci <math>n</math>-step number sequences given its initial values and assuming the number of initial values determines how many previous values are summed to make the next number of the series.
# Use this to print and show here at least the first ten members of the Fibo/tribo/tetra-nacci and Lucas sequences.
;Related tasks:
* &nbsp; [[Fibonacci sequence]]
* &nbsp; [http://mathworld.wolfram.com/Fibonaccin-StepNumber.html Wolfram Mathworld]
* &nbsp; [[Hofstadter Q sequence]]
* &nbsp; [[Leonardo numbers]]
;Also see:
* &nbsp; [https://www.youtube.com/watch?v=PeUbRXnbmms Lucas Numbers - Numberphile] (Video)
* &nbsp; [https://www.youtube.com/watch?v=fMJflV_GUpU Tribonacci Numbers (and the Rauzy Fractal) - Numberphile] (Video)
* &nbsp; [[wp:Lucas number|Wikipedia, Lucas number]]
* &nbsp; [http://mathworld.wolfram.com/FibonacciNumber.html MathWorld, Fibonacci Number]
* &nbsp; [http://www.math-cs.ucmo.edu/~curtisc/articles/howardcooper/genfib4.pdf Some identities for r-Fibonacci numbers]
* &nbsp; [[oeis:A000045|OEIS Fibonacci numbers]]
* &nbsp; [[oeis:A000032|OEIS Lucas numbers]]
<br><br>