buffer prints
This commit is contained in:
parent
a760093f9d
commit
633a31a214
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue