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
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
||||||
|
|
@ -26,12 +28,15 @@ import (
|
||||||
var totientN uint
|
var totientN uint
|
||||||
|
|
||||||
func totient(cmd *cobra.Command, args []string) {
|
func totient(cmd *cobra.Command, args []string) {
|
||||||
|
bufStdout := bufio.NewWriter(os.Stdout)
|
||||||
|
defer bufStdout.Flush()
|
||||||
|
|
||||||
for v := range lib.TotientSieve(totientN) {
|
for v := range lib.TotientSieve(totientN) {
|
||||||
if v == 0 {
|
if v == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(v)
|
fmt.Fprintln(bufStdout, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue