示例#1
0
文件: c027.go 项目: moul/euler
func C027() (interface{}, error) {
	maxA, maxB, maxN := 0, 0, 0
	for a := -1000; a < 1000; a++ {
		for b := 0; b < 1000; b++ {
			n := 0
			for utils.IsPrime(n*n + a*n + b) {
				n++
			}
			if n > maxN {
				maxN = n
				maxA = a
				maxB = b
			}
		}
	}
	return maxA * maxB, nil
}
示例#2
0
文件: c037.go 项目: moul/euler
func isStrPrime(nbStr string) bool {
	nb, _ := strconv.Atoi(nbStr)
	return utils.IsPrime(nb)
}