TITLE: p-groups such that the center is contained in many cyclic subgroups
QUESTION [9 upvotes]: I'm looking for examples of $p$-groups $G$ with the following three properties:

the center of $G$ is $\mathbb{Z}/p$, and
$G^{\text{ab}} = (\mathbb{Z}/p)^n$ for some $n$, and
for every $g \in G$ whose image in $G^{\text{ab}}$ is nonzero, the cyclic group generated by $g$ contains the center.

Easy examples include cyclic groups of order $p$ and the quaternion group.
I'm particularly interested in examples with large $n$.

EDIT: Stefan Kohl's answer is helpful, but not quite what I'm looking for.  Let me ask a slightly more focused question: do there exist examples with $n$ arbitrarily large?

REPLY [6 votes]: We can use the following GAP functions to search examples of groups
with the desired properties:
IsExample := function ( G )

  local  p;

  if not IsPGroup(G) then return false; fi;
  p := PrimePGroup(G);
  if Size(Centre(G)) <> p then return false; fi;
  if Set(AbelianInvariants(G)) <> [p] then return false; fi;
  return ForAll(Difference(AsList(G),AsList(DerivedSubgroup(G))),
                g->IsSubgroup(Group(g),Centre(G)));
end;

AllExamplesOfOrder_n := n -> Filtered(AllGroups(n),IsExample);

What one finds is that all examples whose order is less than $10000$
and not equal to any of $2^9$, $2^{10}$, $2^{11}$, $2^{12}$, $2^{13}$
or $3^8$ and which are neither cyclic nor generalized quaternion groups
are the groups with the following GAP catalogue numbers:
gap> smallexamples := List([ [ 81, 10 ], [ 128, 802 ], [ 729, 96 ],
>                            [ 729, 101 ], [ 2187, 268 ], 
>                            [ 2187, 272 ], [ 2187, 4486 ] ],SmallGroup);;
gap> 
gap> List(smallexamples,AbelianInvariants);
[ [ 3, 3 ], [ 2, 2, 2 ], [ 3, 3 ], [ 3, 3 ], [ 3, 3 ], [ 3, 3 ],
  [ 3, 3, 3 ] ]
gap> List(smallexamples,StructureDescription);
[ "C3 . ((C3 x C3) : C3) = (C3 x C3) . (C3 x C3)", 
  "C2 . ((C2 x (C4 : C4)) : C2) = (C4 x C2 x C2) . (C2 x C2 x C2)", 
  "C3 . ((C9 x C9) : C3) = (C9 x C9) . (C3 x C3)", 
  "C3 . ((C9 x C9) : C3) = (C9 x C9) . (C3 x C3)", 
  "C3 . (((C9 : C9) : C3) : C3) = ((C9 x C9) : C3) . (C3 x C3)", 
  "C3 . (((C9 : C9) : C3) : C3) = ((C9 x C9) : C3) . (C3 x C3)", 
  "C3 . ((C3 x C3 x ((C3 x C3) : C3)) : C3) = (C3 x C3 x C3 x C3) . \
(C3 x C3 x C3)" ]

Thus in particular the maximum $n$ which you can obtain for a group of
order less than $10000$ and not equal to any of $2^9$, $2^{10}$, $2^{11}$, $2^{12}$, $2^{13}$ or $3^8$ is $3$.