OFFSET
1,2
COMMENTS
For n not 2 and not 6, a code C of size n^2 is given by two orthogonal Latin squares A and B of order n by C = {(i,j,A(i,j),B(i,j)): i,j in {1..n}}. Two orthogonal Latin squares of order n exist if and only if n is not 2 and not 6. See A055495.
REFERENCES
Raymond Hill, "A First Course in Coding Theory", Clarendon Press, Oxford, 1986 (see chapter 10, Theorem 10.16)
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (3,-3,1).
FORMULA
a(n) = 2 if n = 2, a(n) = 34 if n = 6, otherwise a(n) = n^2.
From Colin Barker, Nov 04 2015: (Start)
a(n) = 3*a(n-1)-3*a(n-2)+a(n-3) for n>9.
G.f.: -x*(2*x^8-6*x^7+6*x^6-2*x^5+2*x^4-6*x^3+6*x^2-x+1) / (x-1)^3.
(End)
EXAMPLE
a(2) = 2 since the code C={0000,1110} has minimum distance 3 over the alphabet {0,1} and there is no such code with more codewords.
MATHEMATICA
Table[n^2 - 2 (Boole[n == 2] + Boole[n == 6]), {n, 50}] (* Wesley Ivan Hurt, Nov 04 2015 *)
LinearRecurrence[{3, -3, 1}, {1, 2, 9, 16, 25, 34, 49, 64, 81}, 50] (* Harvey P. Dale, Apr 18 2019 *)
PROG
(PARI) Vec(-x*(2*x^8-6*x^7+6*x^6-2*x^5+2*x^4-6*x^3+6*x^2-x+1)/(x-1)^3 + O(x^100)) \\ Colin Barker, Nov 04 2015
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
W. Edwin Clark, Aug 17 2003
EXTENSIONS
More terms from David Wasserman, Feb 16 2005
STATUS
approved