move sieves to subpackage
This commit is contained in:
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package lib
|
||||
package sieve
|
||||
|
||||
func pow(base uint, exp uint) uint {
|
||||
result := uint(1)
|
||||
@@ -42,6 +42,7 @@ func updateMultiples(sieve []uint, x uint, p uint, n uint) {
|
||||
if p*q >= n {
|
||||
break
|
||||
}
|
||||
println(q)
|
||||
|
||||
// sigma_x(p^k) = p^(kx) + sigma_x(p^(k-1))
|
||||
sieve[p*q] = pow(p*q, x) + sieve[q]
|
||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package lib
|
||||
package sieve
|
||||
|
||||
/*
|
||||
MobiusSieve computes mobius(k) for k=1 to n, where mobius is the Mobius function.
|
||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package lib
|
||||
package sieve
|
||||
|
||||
func primeOmegaUpdateMultiples(sieve []uint, p uint, n uint, multiplicity bool) {
|
||||
for q := p; ; q *= p {
|
||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package lib
|
||||
package sieve
|
||||
|
||||
func radicalUpdateMultiples(sieve []uint, p uint, n uint) {
|
||||
for q := p; ; q *= p {
|
||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package lib
|
||||
package sieve
|
||||
|
||||
/*
|
||||
TotientSieve computes totient(k) for k=1 to n, where totient is Euler's totient function. buflen sets the buffer length of the returned channel. Larger buffer lengths can result in better performance at the cost of higher memory usage.
|
||||
Reference in New Issue
Block a user