Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Meissel-Mertens-constant/Go/meissel-mertens-constant.go
Normal file
33
Task/Meissel-Mertens-constant/Go/meissel-mertens-constant.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"rcu"
|
||||
)
|
||||
|
||||
func contains(a []int, f int) bool {
|
||||
for _, e := range a {
|
||||
if e == f {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func main() {
|
||||
const euler = 0.57721566490153286
|
||||
primes := rcu.Primes(1 << 31)
|
||||
pc := len(primes)
|
||||
sum := 0.0
|
||||
fmt.Println("Primes added M")
|
||||
fmt.Println("------------ --------------")
|
||||
for i, p := range primes {
|
||||
rp := 1.0 / float64(p)
|
||||
sum += math.Log(1.0-rp) + rp
|
||||
c := i + 1
|
||||
if (c%1e7) == 0 || c == pc {
|
||||
fmt.Printf("%11s %0.12f\n", rcu.Commatize(c), sum+euler)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue