I won't bet my hand for this but seems to be ok: ClearAll[return]; return[x : {0 ..., 1}, list_] := {#, list[[;; #]]} &[Length@x]; return[x_, y_] := {Length@y, y}; sqPeriod[list_] := return[FindLinearRecurrence[list], list] sqPeriod /@ { {19, 6, 19, 6, 19, 6, 19, 6, 19, 6, 19, 6}, {73, 7, 4, 73, 7, 4, 73, 7, 4, 73, 7, 4, 73, 7}, {73, 7, 4, 7, 2, 6, 7, 2, 7, 73, 9, 17, 7, 7} } // Column ![enter image description here][1] [1]: https://i.sstatic.net/zxu9x.png