How to test given group is special? A group $G$ is said to be special if it can be decomposed into direct product of two groups $A$ and $B$ Where $B$ is a abelian group which is a direct product of $Z_2$'s ( cyclic group of order 2 ) and group $A$ is non abelian and it contains an element of order $x$. One more thing known about $A$ is it has $y$ number of conjugacy classes.
$$G = A \times B$$
Now given a group $G$ by table representation i want to find whether given group is special or not 
Question : What could be the brute force way to test if group is special or not?
I am thinking like first finding the sylow subgroups and then from those try to to do something.
Any high level idea or technique will be appreciated.
 A: Assume that $G$ is special. Then, in the decomposition, $B$ is central in $G$ and of exponent $2$. 
I assume that you have explicitly constructed the character  table of $G$ ("table representation"). Let $\chi_1$,$\dots$, $\chi_s$ be the different characters of $G$.
Claim 1: An element $g\in G$ is central of order $2$ if and only if for all $I$, $\chi_i(g)=\pm \chi_i(1_G)$. 

 Use the complete reducibility of finite groups representations and the existence of a faithful representation of finite dimension for any finite group.

So now you are able to identify all central elements of order $1$ or $2$ (this is a group which contains $B$). 
Claim 2 : Assuming you have  a central subgroup $B$ inside $G$ then $G=A\times B$ if and only if there exist some irreducible representations $\chi_{j_1},\dots, \chi_{j_s}$ of dimension $1$ such that these representations restricted to $B$ gives you the representation table of $B$ and the representations restricted to $A$ are constant equal to $1$. 

 If $G=A\times B$, you have, for any irreducible representation of $B$ and using the natural projection $\pi:G\to B$ it gives you a bunch of irreducible representations which are trivial on $A$ and different on $B$. Conversely you can easily construct $A$ as the kernel of the representations $\chi_{j_1},\dots, \chi_{j_s}$.    

Claim 3 : Assuming that $A$ has $y$ conjugacy classes then $G$ has $2^ky$ conjugacy classes

 I claim that any conjugacy class in $G$ is written $C_a\times b$ where $a\in A$, $C_a$ is a conjugacy class in $A$ and $b\in B$. 

Algorithm:


*

*Identify all central elements of order $1$ or $2$ using the criterion of claim 1. Let $X$ be this set. 

*Compute $k$ such that $2^k=card B$ using claim 3. 

*(Brute Force) for each subgroup $B_0$ of $X$ of order $2^k$, test if there are $2^k$ different irreducible representations of $G$ which gives you the character table of $B_0$. If this is the case, you have found your $B_0$. You construct $A$ by taking the kernel of the aforementioned irreducible representations.
Edit : Claim 2 is not very accurate, but is close enough... I can discuss this if you want but you might want to work it out by yourself.
A: I would say first identify an idenity element of $G$:
To do that do:


*

*Identify $1$.


*

*For each $x \in G$,

*$e := x$   

*For each $y \in G$,


*

*If $xy \neq y$:


*

*$e = $ Null

*break inner loop



*If $e = $ Null:


*

*continue outer loop


*Else:        


*

*return $e$.





Now looking at the direct product, each summand is isomorphic to the subgroup $1 \oplus C \oplus \cdots \oplus 1$ so that if $G = A \oplus (\Bbb{Z}_2)^k$.  You want to test if there are $k$ elements $x$ such that $x^2 = e$ and such that for any two elements $x, x'$, you have $C_x \cap C_{x'} = 1$ which is to say $x \neq x'$.  So you need only to search for $k$ such distinct elements.  First search for $k = 1$.  Then iterate and search for $k = 2$ by keeping a set (for fast lookup) of previously found elements.  So search for the maximum $k$ such that the above holds.   Only search up to $k = |G| - 6 = |G| - 5 - |e|$ since no group $\leq 5$ in order is non-abelian.
The next step is to test whether the remainder summand $A$ is abelian.  First take all remaining elements (leftover after above $\Bbb{Z}_2^k$ step, and see if they form a group.  If they do then by closure they are disjoint from the rest of the $x \in $ above step by definition.
Then verify that $A$ is non-abelian.  To do that just look at the composition table like a matrix and verify that it is non-symmetric across the diagonal.
If any part of the above fails, return an error code indicating NotGroup, NotSpecial, and so on...

Correction to the above:
You may have that $A \geqslant \Bbb{Z}_2$ for some generator $x$ in the $\Bbb{Z}_2^k$ step above.  If that's true, then for each $k = 1, 2, \dots, |G| - 6$ perform the last step (rearrange above pseudocode) and search for groupness and non-abelianness in the remainder after $k$ elements removed.  Continue all the way to $|G| - 6$ always if and only iff you want to list all possible special group decompositions.
A: Say we have the group $G$ and we pick an element $c$ of order 2. It is easy to check if $<c>$ is a normal group. 
. An element in $G$ and not in $<c>$ can be written as $a=p_1p_2...p_{i-1}cp_i...p_n$. But because $<c>$ is normal  we have $a=p_1p_2...p_{i-1}p_ip_i^{-1}cp_i...p_n=p_1p_2...p_{i-1}p_icp_{i+1}...p_n$ and thereofe every element can be written $a=p_1p_2,....,p_nc$ where $p_i$ can't contain a product of $c$ (unless it is $c\cdot c^{-1}=1$). 
If we denote as $N$ all the elements that cannot be written as 
 $\text{something}\cdot c$ then because of the previous paragraph $G=N<c>$ (that is the set with all the possible combination of elements)and because $N$ is normal and $N\cap <c>=1$ we have that $G=N\times <c>$. 
We now do the following procedure to $N$ until we have exausted all the $\mathbb{Z_2}$.
