buffer prints

This commit is contained in:
filifa 2025-10-01 22:21:02 -04:00
parent a760093f9d
commit 633a31a214
1 changed files with 6 additions and 1 deletions

View File

@ -17,7 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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)
}
}