예제 #1
0
func main() {
	starttime := time.Now()

	radTable := make(map[int64][]int64)

	for i := int64(2); i <= max; i++ {
		factor := euler.Factor(i)
		factor = euler.RemoveDuplicates(factor)

		rad := int64(1)

		for _, fac := range factor {
			rad *= fac
		}

		radTable[rad] = append(radTable[rad], i)

	}

	current := 1
	for i := int64(0); i <= max; i++ {
		if answer, ok := radTable[i]; ok {
			//	fmt.Println(current)

			if current < target && current+len(answer) >= target {
				pos := target - current - 1
				fmt.Println(answer[pos])
			}
			//fmt.Println(i, answer)
			current += len(answer)
		}
	}

	fmt.Println("Elapsed time:", time.Since(starttime))
}
예제 #2
0
func main() {
	var c, i uint64
	for i = 2; c != 4; i++ {
		if len(euler.Factor(i)) == 4*2 {
			c++
		} else {
			c = 0
		}
	}
	fmt.Printf("47 %d\n", i-3)
}
예제 #3
0
func main() {
	uniq := make(map[string]bool)
	for a := uint64(2); a <= 100; a++ {
		for b := uint64(2); b <= 100; b++ {
			f := euler.Factor(a)
			for i := 0; i < len(f); i = i + 2 {
				f[i] = f[i] * b
			}
			uniq[stringify(f)] = true
		}
	}
	fmt.Printf("29 %d\n", len(uniq))
}