cp's OEIS Frontend

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.

A057595 Triangle T(n,k) giving 2*p mod n-1, where p = period of sequence k^i (i=0,1,2,...) mod n (n >= 2, 2<=k<=n).

Original entry on oeis.org

0, 0, 0, 2, 1, 2, 0, 0, 0, 2, 4, 2, 2, 4, 2, 0, 0, 0, 0, 4, 2, 2, 4, 2, 4, 2, 4, 2, 4, 2, 6, 4, 2, 6, 4, 2, 8, 8, 4, 2, 2, 8, 8, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 4, 4, 2, 4, 2, 4, 4, 2, 2, 4, 2, 0, 6, 0, 8, 0, 0, 8, 6, 0, 0, 4, 2
Offset: 2

Views

Author

Gottfried Helms, Oct 05 2000

Keywords

Examples

			0; 0,0; 2,1,2; 0,0,0,2; ...
		

Crossrefs

Programs

  • Mathematica
    period[lst_] := Module[{n, i, j}, n = Length[lst]; For[j = 2, j <= n, j++, For[i = 1, i < j, i++, If[lst[[i]] == lst[[j]], Return[{i - 1, j - i}]]]]; Return[{0, 0}]]; T[n_, k_] := Module[{t, p}, t = Table[PowerMod[k, i, n], {i, 0, 2 n}]; p = period[t][[2]]; Mod[2 p, n - 1]]; Table[T[n, k], {n, 2, 13}, {k, 2, n}] // Flatten (* Jean-François Alcover, Feb 04 2015 *)