  Counting ground state degeneracy of a $k$-local Hamiltonian is important in
many fields of physics. Its complexity belongs to the problem of sharp
bounded-error quantum polynomial time (#BQP) class and few methods are known
for its solution. Finding ground states of a $k$-local Hamiltonian, on the
other hand, is an easier problem of Quantum Merlin Arthur (QMA) class, for
which many efficient methods exist. In this work, we propose an algorithm of
mapping a #BQP problem into one of finding a special ground state of a
$k$-local Hamiltonian. We prove that all traditional methods, which solve the
QMA problem by evolution under a function of a Hamiltonian, can be used to find
the special ground state from a well-designed initial state, thus can solve the
#BQP problem. We combine our algorithm with power method, Lanczos method, and
quantum imaginary time evolution method for different systems to illustrate the
detection of phase boundaries, competition between frustration and quantum
fluctuation, and potential implementations with quantum circuits.
