This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A253387 #7 Jan 05 2015 08:57:31 %S A253387 97,97,1,1,2,2,2,2,316,316,2,2,3,3,3,3,3,3,4,4,12,12,4,4,4,4,12,12,11, %T A253387 11,11,11,316,316,11,11,316,316,316,316,6,6,316,316,316,316,316,316, %U A253387 316,316,97,97,316,316,316,316,13,13,316,316,13 %N A253387 A "mod sequence" where a(n) is the eventual constant value attained by the sequence defined as b(1) = n, b(m) = (sum_{k=1..m-1} b(k)) mod m, with a(n) = -1 in case a constant run is not found. %H A253387 Jean-François Alcover, <a href="/A253387/b253387.txt">Table of n, a(n) for n = 1..1000</a> %H A253387 MathOverflow, <a href="http://mathoverflow.net/questions/191518">Mod sequences that seem to become constant</a> %e A253387 a(5) = 2, because the b sequence is 5, 1, 0, 2, 3, 5, 2, 2, 2, 2, 2, ... %t A253387 Clear[a]; constantLength = 10; kMax = 2000; a[n_] := a[n] = Module[{k}, Clear[b]; For[ b[1] = n; b[m_] := b[m] = Mod[Sum[b[j], {j, 1, m-1}], m]; k = constantLength, k <= kMax, k++, If[Equal @@ Table[b[k-j], {j, 0, constantLength-1}], Print["a(", n, ") = ", b[k], ", k = ", k - constantLength+1]; Return[b[k]]]]; Print["a(", n, ") = ", -1, ", k = ", k - constantLength+1, " constant run not found"]; Return[-1]]; Table[a[n], {n, 1, 100}] %Y A253387 Cf. A074482, A117846. %K A253387 sign %O A253387 1,1 %A A253387 _Jean-François Alcover_, Dec 31 2014