diff --git a/cmd/convergents.go b/cmd/convergents.go index 3d665e9..2f512ff 100644 --- a/cmd/convergents.go +++ b/cmd/convergents.go @@ -54,16 +54,21 @@ func convergents(cmd *cobra.Command, args []string) { seq(h, hprev, a0) seq(k, kprev, a0) - fmt.Println(h, k) + + r := new(big.Rat).SetFrac(h, k) + fmt.Println(r) for i := 0; true; i = (i + 1) % len(denoms) { a := &denoms[i] seq(h, hprev, a) seq(k, kprev, a) - fmt.Println(h, k) + + r.SetFrac(h, k) + fmt.Println(r) } } +// FIXME: should support an initial block of non-periodic denominators (will need flags) // convergentsCmd represents the convergents command var convergentsCmd = &cobra.Command{ Use: "convergents N N [N ...]",