TITLE: Ordering finite groups by sum of order of elements
QUESTION [11 upvotes]: Given two finite groups $G, H$, we are going to say that $G<_oH$ if either
a. $|G|<|H|$
or 
b. $|G|=|H|$ and $\displaystyle\sum_{g\in G} o(g)<\sum_{h\in H} o(h)$,
where $o(g)$ denotes the order of the element $g$ (has this ordering a name?).
What is the smallest example (in this ordering) of a pair of nonisomorphic groups such that $G$ and $H$ are incomparable, i.e., such that they have same cardinal and same sum of orders of elements?

REPLY [3 votes]: To give an answer which uses open source software - one could do this in GAP.
First, the GAP code based on the one from the answer by @Travis. It looks quite similar.
gap> sumOfOrders := G -> Sum(List(G,Order));
function( G ) ... end
gap> sumOfOrdersList := n -> SortedList(List(AllSmallGroups(n),sumOfOrders));
function( n ) ... end
gap> List([1..16],sumOfOrdersList);
[ [ 1 ], [ 3 ], [ 7 ], [ 7, 11 ], [ 21 ], [ 13, 21 ], [ 43 ], 
  [ 15, 19, 23, 27, 43 ], [ 25, 61 ], [ 31, 63 ], [ 111 ], 
  [ 31, 33, 45, 49, 77 ], [ 157 ], [ 57, 129 ], [ 147 ], 
  [ 31, 39, 47, 47, 47, 55, 55, 55, 59, 67, 75, 87, 87, 171 ] ]

You can see that the last list contains 47 three times. Now let's find those three groups:
gap> l:=AllSmallGroups(16,g->sumOfOrders(g)=47);
[ <pc group of size 16 with 4 generators>, 
  <pc group of size 16 with 4 generators>, 
  <pc group of size 16 with 4 generators> ]

and get their IDs:
gap> List(l,IdGroup);
[ [ 16, 3 ], [ 16, 10 ], [ 16, 13 ] ]

Some notion about their structure can be obtained by StructureDescription (which however does not define the group up to isomorphism - see here):
gap> List(l,StructureDescription);
[ "(C4 x C2) : C2", "C4 x C2 x C2", "(C4 x C2) : C2" ]

If I would be less lucky and did not manage to find an example with such quick exploration, I would likely write some code for more systematic search, which would look like the code below, following the guidelines from "Small groups search" in the GAP Software Carpentry lesson:
TestOneOrder:=function(n)
# find the smallest example among the groups of order n
local s,i,m,d,x;
# Calculate lists of sums of element orders.
# Avoid using AllSmallGroups(n) which potentially may be very large
s := List([1..NrSmallGroups(n)],i->Sum(List(SmallGroup(n,i),Order)));
if Length(Set(s))=NrSmallGroups(n) then
  # Sum of element orders uniquely defines each group
  return fail;
else
  # There are duplicates - find them first
  d := Filtered( Collected(s), x -> x[2] > 1 );
  # Find the minimal possible value of the sum of element orders
  m := Minimum( List( d, x-> x[1] ) );
  # Find positions of m in the list
  # Return the list of group IDs
  return List( Positions(s,m), x -> [n,x] );
fi;
end;

FindSmallestPair:=function(n)
# check all groups of order up to n
local i, res;
for i in [1..n] do
  # \r at the end of the print returns to the beginning of the line
  Print("Checking groups of order ", i, "\r");
  res := TestOneOrder(i);
  if res<>fail then
    # print new line before displaying the output 
    Print("\n");
    return res;
  fi;
od;
return fail;
end;    

You can find this code on GutHub here. Reading it into GAP, one could obtain the same result as follows:
gap> FindSmallestPair(20);
Checking groups of order 16
[ [ 16, 3 ], [ 16, 10 ], [ 16, 13 ] ]