%I M2280 N0902 #59 Jul 01 2024 14:55:37
%S 1,1,3,3,5,9,21,21,81,81,81,243,243,441,1215,1701,1701,6561,6561,6561,
%T 45927,45927,45927,137781,137781,229635,1594323,1594323,1594323,
%U 4782969,4782969,7971615,14348907,33480783,33480783,129140163,129140163,129140163
%N Largest order of automorphism group of a tournament with n nodes.
%D J. W. Moon, Topics on Tournaments. Holt, NY, 1968, p. 81.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Joseph Myers, <a href="/A000198/b000198.txt">Table of n, a(n) for n = 1..1000</a>
%H B. Alspach, <a href="http://dx.doi.org/10.4153/CMB-1968-078-3">A combinatorial proof of a conjecture of Goldberg and Moon</a>, Canad. Math. Bull. 11 (1968), 655-661.
%H B. Alspach, <a href="https://doi.org/10.4153/CMB-1970-061-7">On point-symmetric tournaments</a>, Canad. Math. Bull., 13 (1970), 317-323. [<a href="/A002086/a002086.pdf">Annotated copy</a>] See g(n) as defined on page 317 (NOT on page 322).
%H B. Alspach and J. L. Berggren, <a href="http://dx.doi.org/10.4153/CMB-1973-003-7">On the determination of the maximum order of the group of a tournament</a>, Canad. Math. Bull 16 (1973), 11-14.
%H J. D. Dixon, <a href="http://dx.doi.org/10.4153/CMB-1967-048-9">The maximum order of the group of a tournament</a>, Canad. Math. Bull. 10 (1967), 503-505.
%H <a href="/index/To#tournament">Index entries for sequences related to tournaments</a>
%F a(3^k) = 3^((3^k - 1)/2), a(5*3^k) = 5*3^((5*3^k - 5)/2), a(7*3^k) = 7*3^((7*3^k - 5)/2), and, for all other n, a(n) = max(a(i)a(n-i)) where the maximum is taken over 1 <= i <= n-1 (from Alspach and Berggren (1973) Theorem 4).
%F a(3r) = (3^r)a(r), a(n) = a(n-1) for n = 1, 2 or 4 mod 9, a(9k+8) = max(a(9k+7), a(5)a(9k+3)), a(9k+5) = max(a(2)a(9k+3), a(5)a(9k), a(7)a(9k-2)), a(9k+7) = a(7)a(9k) (from Alspach and Berggren (1973) Theorem 5).
%p a:= proc(n) local t, r; t:= irem(n, 9);
%p `if`(3^ilog[3](n)=n, 3^((3^ilog[3](n)-1)/2),
%p `if`(irem(n, 5, 'r')=0 and 3^ilog[3](r)=r, 5*3^((5*3^ilog[3](r)-5)/2),
%p `if`(irem(n, 7, 'r')=0 and 3^ilog[3](r)=r, 7*3^((7*3^ilog[3](r)-5)/2),
%p `if`(irem(n, 3, 'r')=0, 3^r*a(r),
%p `if`(t in {1, 2, 4}, a(n-1),
%p `if`(t = 8, max(a(n-1), a(5)*a(n-5)),
%p `if`(t = 5, max(a(2)*a(n-2), a(5)*a(n-5), a(7)*a(n-7)),
%p a(7)*a(n-7) )))))))
%p end:
%p seq(a(n), n=1..50); # _Alois P. Heinz_, Jun 29 2012
%t a[n_] := a[n] = With[{t = Mod[n, 9]}, Which[ IntegerQ[Log[3, n]], 3^((1/2)*(n-1)),{q, r} = QuotientRemainder[n, 5]; r == 0 && IntegerQ[Log[3, q]], 5*3^((1/2)*(n-5)),{q, r} = QuotientRemainder[n, 7];r == 0 && IntegerQ[Log[3, q]], 7*3^((1/2)*(n-5)), {q, r} = QuotientRemainder[n, 3]; r == 0, 3^q*a[q],MemberQ[{1, 2, 4}, t], a[n-1],t == 8, Max[a[n-1], a[5]*a[n-5]], t == 5, Max[a[2]*a[n-2],a[5]*a[n-5], a[7]*a[n-7]],True, a[7]*a[n-7]]]; Table[a[n], {n, 1, 38}] (* _Jean-François Alcover_, Nov 12 2012, after _Alois P. Heinz_ *)
%o (Python)
%o from functools import lru_cache
%o @lru_cache(maxsize=None)
%o def A000198(n):
%o if n <= 7: return (1, 1, 3, 3, 5, 9, 21)[n-1]
%o if (r:=n%9) in {0,3,6}:
%o return 3**(m:=n//3)*A000198(m)
%o elif r in {1,2,4}:
%o return A000198(n-1)
%o elif r == 5:
%o return max(A000198(n-2),5*A000198(n-5),21*A000198(n-7))
%o elif r == 7:
%o return 21*A000198(n-7)
%o elif r == 8:
%o return max(A000198(n-1),5*A000198(n-5)) # _Chai Wah Wu_, Jul 01 2024
%Y Cf. A000568, A374164.
%K nonn,nice
%O 1,3
%A _N. J. A. Sloane_
%E Edited and extended by _Joseph Myers_, Jun 28 2012