OFFSET
1,2
COMMENTS
Permutations of n elements such that each row in the difference table consists of pairwise distinct elements, even when taken modulo n (see example).
For n<=29 the nonzero terms a(n) appear for n in A006093 (primes minus 1) and a(n)=A002618(n) (n*phi(n)); omitting the zeros we obtain A104039 (number of primitive roots modulo (p(n))^2, where p(n) is n-th prime).
A002618(n) divides a(n) for all n, since (treating elements as integers modulo n) adding or subtracting a constant from each element or multiplying each element by an integer coprime to n preserves distinctness of all values modulo n. - Charlie Neder, May 26 2019
LINKS
Scott Rickard, costasarrays.org (information and papers about Costas arrays). [broken link?]
Wikipedia, Costas array.
EXAMPLE
The permutation (10, 9, 2, 8, 6, 1, 3, 7, 4, 5) corresponds to a Costas array:
10 9 2 8 6 1 3 7 4 5 (Permutation: p(1), p(2), p(3), ..., p(n) )
-1 -7 6 -2 -5 2 4 -3 1 (step-1 differences: p(2)-p(1), p(3)-p(2), ... )
-8 -1 4 -7 -3 6 1 -2 (step-2 differences: p(3)-p(1), p(4)-p(2), ... )
-2 -3 -1 -5 1 3 2 (step-3 differences: p(4)-p(1), p(5)-p(2), ... )
-4 -8 1 -1 -2 4 ( etc. )
-9 -6 5 -4 -1
-7 -2 2 -3
-3 -5 3
-6 -4
-5
The values in each row are unique also modulo n=10:
10 9 2 8 6 1 3 7 4 5 (Permutation: p(1), p(2), p(3), ..., p(n) )
9 3 6 8 5 2 4 7 1 (step-1 differences: p(2)-p(1), p(3)-p(2), ... )
2 9 4 3 7 6 1 8 (step-2 differences: p(3)-p(1), p(4)-p(2), ... )
8 7 9 5 1 3 2 (step-3 differences: p(4)-p(1), p(5)-p(2), ... )
6 2 1 9 8 4 ( etc. )
1 4 5 6 9
3 8 2 7
7 5 3
4 6
5
CROSSREFS
KEYWORD
nonn,hard,more
AUTHOR
Joerg Arndt, Jun 08 2012
STATUS
approved