It is proved that, given a linear algebraic group defined over an algebraic number field and satisfying certain conditions, there exists an algorithm which determines whether or not two double cosets of a special type coincide in its adele group, and which enumerates all such double cosets. This result is applied to the isomorphism problem for finitely generated nilpotent groups, and also to other problems.Bibliography: 18 titles.