How many groups of order $512$ and $1024$ are there with a center of size $2$? I did not find a sequence in OEIS about the number of groups of a given order with a center of size $2$.
For the first few powers of $2$, the numbers are :
$2$ : $1$ group
$4$ : $0$ groups
$8$ : $2$ groups
$16$ : $3$ groups
$32$ : $10$ groups
$64$ : $27$ groups
$128$ : $121$ groups
$256$ : $605$ groups
I wanted to count the number of groups of order $512$ with a size of center $2$ with GAP, but it takes very long.
The first million of the groups contains $4842$ examples, the next million of groups all have center-size $16$ and the groups from $10,400,000$ to the last group contains $29$ such groups

Questions : Does anyone know the number of groups of order $n$ with a center of size$2$ for $n=512$ and $1024$ ?
Can the probability that a random group of order $n$ has a center of size $2$ be estimated for higher values ($2048$ or even $4096$) ?

 A: I have the data for groups of order $512$ which I calculated using ParGAP package on an 8-core machine for the 2009 paper "The modular isomorphism problem for the groups of order $512$" with Bettina Eick.
For groups of order $512$, I have:
gap> Length(centersize);
10494213
gap> Collected(centersize);
[ [ 2, 5327 ], [ 4, 128741 ], [ 8, 4303591 ], [ 16, 6025263 ], 
  [ 32, 30014 ], [ 64, 1063 ], [ 128, 184 ], [ 512, 30 ] ]

so the number of groups with the centre of order $2$ is $5327$. 
My data agree with your observations:
gap> Number([1..10^6],i->centersize[i]=2);
4842
gap> Number([10^6+1 .. 2*10^6],i->centersize[i]=2);
0
gap> ForAll([10^6+1 .. 2*10^6],i->centersize[i]=16);
true
gap> Number([10400000 .. Length(centersize)],i->centersize[i]=2);
29

Groups of order 1024 are not included in the GAP Small Groups Library, so this is going to be harder. I don't know if anyone knows.
For even larger groups, to start with, is there a clean definition what does "the random group of order $n$" mean?
