Unfortunately, there is often no definitive way to determine a pattern within
some given set of numbers, since patterns may be as arbitrary as you like. However, there are some ways of seeing patterns a little more clearly.
By way of example, I'm going to rewrite these relations in a slightly different way. Using that as a hint, try and find the relations yourself. I'll place the answer in a spoiler below.
Group A:
$5\to 2^2\cdot5$
$6\to 2^5$
$7\to 2^4\cdot7$
$8\to 2^6\cdot3$
$9\to 2^6\cdot9$
$10\to 2^{10}$
Group B:
$7\to 2^3\cdot7$
$8\to 2^4\cdot5$
$9\to 2^4\cdot3\cdot9$
$10\to 2^5\cdot3\cdot7$
Group A:
When $n$ is odd, $n\to n2^{n-2}$. When $n$ is even, $n\to2^{n-3}(n-2)$
Group B:
When $n$ is odd, $n\to 2^{n-6}\cdot n(n-3)$. When $n$ is even, $n\to 2^{n/2}(n-3)(n-7)$