示例#1
0
func main() {
	sum := float64(1)
	m := make(map[int64]int64)

	// 最大時数を抽出
	for i := int64(2); i <= 20; i++ {
		for key, value := range util.PrimeDecomposition(i) {

			if m[key] == 0 {
				m[key] = value
			} else {
				if m[key] < value {
					m[key] = value
				}
			}
		}
	}

	for key, value := range m {
		fmt.Printf("sum = %f, key = %f, value = %f\n", sum, key, value)
		sum = sum * math.Pow((float64)(key), (float64)(value))
	}

	fmt.Printf("%f", sum)

}
示例#2
0
func resolver() util.Resolver {
	fc := func() {
		for i := 1; ; i++ {
			num := triagleNumbers(i)
			divisors := int64(1)
			for _, value := range util.PrimeDecomposition(int64(num)) {
				divisors = divisors * (value + 1)
			}
			if divisors > 500 {
				fmt.Printf("i = %d, num = %d, divisors = %d\n", i, num, divisors)
				break
			}
		}
	}
	return fc
}