29: distinct powers

This commit is contained in:
VicRen
2020-10-29 09:57:13 +08:00
parent 39ce9f566a
commit 6365bf40b0

View File

@@ -0,0 +1,29 @@
package main
import (
"fmt"
"math/big"
"strconv"
)
func main() {
m := map[string]struct{}{}
count := 0
for i := 2; i <= 100; i++ {
for j := 2; j <= 100; j++ {
c := 1
p, _ := (&big.Int{}).SetString(strconv.Itoa(1), 0)
t, _ := (&big.Int{}).SetString(strconv.Itoa(i), 0)
for c <= j {
p = p.Mul(p, t)
c++
}
fmt.Println(i, j, p.String())
count++
if _, ok := m[p.String()]; !ok {
m[p.String()] = struct{}{}
}
}
}
fmt.Println("len:", len(m), "count:", count)
}