Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Repunit-primes/Go/repunit-primes.go
Normal file
24
Task/Repunit-primes/Go/repunit-primes.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
big "github.com/ncw/gmp"
|
||||
"rcu"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
limit := 2700
|
||||
primes := rcu.Primes(limit)
|
||||
s := new(big.Int)
|
||||
for b := 2; b <= 36; b++ {
|
||||
var rPrimes []int
|
||||
for _, p := range primes {
|
||||
s.SetString(strings.Repeat("1", p), b)
|
||||
if s.ProbablyPrime(15) {
|
||||
rPrimes = append(rPrimes, p)
|
||||
}
|
||||
}
|
||||
fmt.Printf("Base %2d: %v\n", b, rPrimes)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue