diff --git a/cmd/totient.go b/cmd/totient.go index 9b76cbe..74375db 100644 --- a/cmd/totient.go +++ b/cmd/totient.go @@ -17,7 +17,9 @@ along with this program. If not, see . package cmd import ( + "bufio" "fmt" + "os" "github.com/spf13/cobra" "scm.dairydemon.net/filifa/mathtools/internal/lib" @@ -26,12 +28,15 @@ import ( var totientN uint func totient(cmd *cobra.Command, args []string) { + bufStdout := bufio.NewWriter(os.Stdout) + defer bufStdout.Flush() + for v := range lib.TotientSieve(totientN) { if v == 0 { continue } - fmt.Println(v) + fmt.Fprintln(bufStdout, v) } }