For example,
{1,2,3,4,5,6,7,8}
has period 1, the base is {1}
{1,2,4,5,7,8,10,11}
has period 3, the base is {1,2}
I notice there is a built-in function FunctionPeriod
, but it doesn't work. eg
l[n_]:={1,2,4,5,7,8,10,11}[[n]]
FunctionPeriod[l[n],n,Integers]
So how to write a function period
to find the period of discrete sequence.
ps: The sequence could be non-integers, for example sqrt, reals,
Differences
to them, you do get a periodic sequence. $\endgroup$FunctionPeriod[FindSequenceFunction[Differences[{1, 2, 4, 5, 7, 8, 10, 11}], k], k]
. $\endgroup$