move sieves to subpackage
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib/sieve"
|
||||
)
|
||||
|
||||
var divisorsN uint
|
||||
@@ -32,7 +32,7 @@ func divisors(cmd *cobra.Command, args []string) {
|
||||
bufStdout := bufio.NewWriter(os.Stdout)
|
||||
defer bufStdout.Flush()
|
||||
|
||||
ch := lib.DivisorsSieve(divisorsN, divisorsE, 1000)
|
||||
ch := sieve.DivisorsSieve(divisorsN, divisorsE, 1000)
|
||||
for i := 0; ; i++ {
|
||||
v, ok := <-ch
|
||||
if !ok {
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib/sieve"
|
||||
)
|
||||
|
||||
var mobiusN uint
|
||||
@@ -31,7 +31,7 @@ func mobius(cmd *cobra.Command, args []string) {
|
||||
bufStdout := bufio.NewWriter(os.Stdout)
|
||||
defer bufStdout.Flush()
|
||||
|
||||
ch := lib.MobiusSieve(mobiusN, 1000)
|
||||
ch := sieve.MobiusSieve(mobiusN, 1000)
|
||||
for i := 0; ; i++ {
|
||||
v, ok := <-ch
|
||||
if !ok {
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib/sieve"
|
||||
)
|
||||
|
||||
var primeOmegaN uint
|
||||
@@ -32,7 +32,7 @@ func primeOmega(cmd *cobra.Command, args []string) {
|
||||
bufStdout := bufio.NewWriter(os.Stdout)
|
||||
defer bufStdout.Flush()
|
||||
|
||||
ch := lib.PrimeOmegaSieve(primeOmegaN, primeOmegaMul, 1000)
|
||||
ch := sieve.PrimeOmegaSieve(primeOmegaN, primeOmegaMul, 1000)
|
||||
for i := 0; ; i++ {
|
||||
v, ok := <-ch
|
||||
if !ok {
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib/sieve"
|
||||
)
|
||||
|
||||
var radicalN uint
|
||||
@@ -31,7 +31,7 @@ func radical(cmd *cobra.Command, args []string) {
|
||||
bufStdout := bufio.NewWriter(os.Stdout)
|
||||
defer bufStdout.Flush()
|
||||
|
||||
ch := lib.RadicalSieve(radicalN, 1000)
|
||||
ch := sieve.RadicalSieve(radicalN, 1000)
|
||||
for i := 0; ; i++ {
|
||||
v, ok := <-ch
|
||||
if !ok {
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib"
|
||||
"scm.dairydemon.net/filifa/mathtools/internal/lib/sieve"
|
||||
)
|
||||
|
||||
var totientN uint
|
||||
@@ -31,7 +31,7 @@ func totient(cmd *cobra.Command, args []string) {
|
||||
bufStdout := bufio.NewWriter(os.Stdout)
|
||||
defer bufStdout.Flush()
|
||||
|
||||
for v := range lib.TotientSieve(totientN, 1000) {
|
||||
for v := range sieve.TotientSieve(totientN, 1000) {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user