A basis of the group of primitive almost pythagorean triples
  Let $m$ be a fixed square-free positive integer, then equivalence classes of solutions of Diophantine equation $x^2+m\cdot y^2=z^2$ form an infinitely generated abelian group under the operation induced by the complex multiplication. A basis of this group is constructed here using prime ideals and the ideal class group of the field $\mathbb Q (\sqrt{-m})$. 
Nikolai A. Krylov
math.NT