[go: up one dir, main page]

login
A051864
Sum of transposition distances (divided by 2) present in the permutation produced by inverses of 1..(p-1) computed in Zp, where p is n-th prime.
0
0, 0, 1, 4, 10, 25, 33, 46, 58, 97, 130, 247, 243, 310, 312, 417, 444, 729, 738, 654, 1007, 836, 968, 1095, 1623, 1603, 1720, 1652, 1997, 2143, 2872, 2786, 3123, 2920, 3069, 3534, 4103, 4654, 4130, 4933, 4434, 5355, 5576, 6959, 5915, 5788, 7440, 7994
OFFSET
1,4
FORMULA
a(n) = sum_of_transposition_distances(n) (see Maple code given below)
EXAMPLE
Inverses of 1 .. 10 in field Z11 are: 1,6,4,3,9,2,8,7,5,10 (e.g. 9*5 = 45 = 1 mod 11) if we count each inverse's "distance from its own position", we get 0+4+1+1+4+4+1+1+4+0 = 20, divided by 2 is 10, so a(5)=10 (11 is the fifth prime).
MAPLE
with(numtheory); sum_of_transposition_distances := proc(n) local p, i; p := ithprime(n); add(abs(op(2, op(1, msolve(i*x=1, p)))-i), i=1..(p-1))/2; end;
MATHEMATICA
a[n_] := Module[{p = Prime[n], x}, Sum[x - i /. Solve[i*x == 1, Modulus -> p] // First // Abs, {i, 1, p - 1}]/2]; Array[a, 50] (* Jean-François Alcover, Mar 05 2016 *)
CROSSREFS
Sequence in context: A127070 A365861 A107961 * A111153 A265438 A145368
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 14 1999
STATUS
approved