Consider a sequence starting with 2, subtract 2 to get the next term, now add 3 to get the next term and so on according to the rule (-2,+3) consecutively which starts like
s = {2, 0, 3, 1, 4, 2, 5, 3, 6, 4};
and ask for the sequence function:
FindSequenceFunction[s, n] // Simplify
$\frac{3 \left(894-909 n+307 n^2-42 n^3+2 n^4\right)}{2 \left(579-539 n+170 n^2-22 n^3+n^4\right)}$
This strange looking formula is in fact the wrong alternative, as the next term should be 4 + 3 = 7. Instead it repdocuces just the given terms an gives fractions beyond:
Table[%, {n, 0, 20}]
(* Out[94]= {447/193, 2, 0, 3, 1, 4, 2, 5, 3, 6, 4, 711/193, 1545/437, 968/281, 1654/489, \
377/113, 571/173, 2490/761, 24504/7543, 3723/1153, 44757/13933} *)
Let us now drop the last element of s:
FindSequenceFunction[Drop[s, 1], n] // Simplify
(* Out[72]= 1/4 (3 + 5 (-1)^n + 2 n) *)
Table[1/4 (3 + 5 (-1)^n + 2 n), {n, 0, 10}]
(* Out[80]= {2, 0, 3, 1, 4, 2, 5, 3, 6, 4, 7} *)
This formula is correct.
The same holds if we append one term to s
FindSequenceFunction[Join[s, {7}], n] // Simplify
(* Out[74]= 1/4 (1 - 5 (-1)^n + 2 n) *)
Table[1/4 (1 - 5 (-1)^n + 2 n), {n, 1, 10}]
(* Out[82]= {2, 0, 3, 1, 4, 2, 5, 3, 6, 4} *)
Question: is there a general rule for the reliability of the result of FindSequenceFunction[]?
Regards,
Wolfgang
