# Possible bug with FindSequenceFunction$.$

Consider the following code:

g = Table[Sign[StieltjesGamma[n]], {n, 0, 30}];
s = FindSequenceFunction[g];


The result is a certain DifferenceRoot object (too long to include here), which essentially solves the recurrence relation $$a_{n+1}=a_n$$ with "initial conditions" $a_i=g_i$. In other words, the DifferenceRoot is actually storing the first 30 elements of g as initial conditions, and predicting the rest to be a constant sequence: $$s_i=\begin{cases}g_i & i\in[1,30]\\ 1 & i>30\end{cases}$$

This is obviously cheating: you could do the same thing to any sequence, that is, store all the known elements as initial conditions to an arbitrary recurrence relation, and predict the rest using that recurrence relation. Such a prediction would be meaningless. Is this behaviour of FindSequenceFunction a bug?

Note that in this case there is no known closed-form expression for g, so s should be returned unevaluated. In fact, that's what I expected to get; the DifferenceRoot object was certainly a surprise. In any case, there is nothing special about the Stieltjes constants: the sequence g can be replaced with any random sequence of integers, such as

SeedRandom[1]
g = RandomChoice[{-1, 1}, 30];


which has the same behaviour: FindSequenceFunction returns a DifferenceRoot object that stores the elements of g as initial conditions to an (arbitrarily chosen?) recurrence relation.

• I'm not sure what tags to use here. Please feel free to edit them. I do know I'm not supposed to add the bug one though... – AccidentalFourierTransform Jan 30 '18 at 17:40
• why this should be a bug? In this way, and as you note, FindSequenceFunction can predict any element of the sequence, can't it? Or am I missing something ? – José Antonio Díaz Navas Jan 30 '18 at 18:37
• @JoséAntonioDíazNavas It doesn't "predict" anything. It just stores what you already know, and fails to predict the rest of the sequence. Note that the Stieltjes constants are not all positive for $i>30$, unlike what s suggests. – AccidentalFourierTransform Jan 30 '18 at 18:54
• note you do not get such result for every random sequence. – george2079 Jan 30 '18 at 18:54
• FindSequenceFunction makes no claim at being predictive. You may be right it is a useless result, but not a bug. – george2079 Jan 30 '18 at 18:56