Пример #1
0
func (e *Euler) Problem_3() {
	var num int64
	num = 600851475143
	for i := eulerutils.Sqrt(num); i > 0; i-- {
		if num%i == 0 && eulerutils.IsPrime(i) {
			fmt.Println("Solution: ", i)
			return
		}
	}
	fmt.Println("something bad happened")
}
Пример #2
0
func (e *Euler) Problem_7() {
	primeCount := 0
	var index int64 = 0
	for {
		if eulerutils.IsPrime(index) {
			primeCount++
			if primeCount == 10001 {
				break
			}
		}
		index++
	}
	fmt.Println("The 10001 prime is ", index)
}