示例#1
0
文件: pr046.go 项目: d3zd3z/euler
// Return the ISqrt of the number, if the number is a perfect square,
// otherwise not.
func perfect_root(base int) (root int, perfect bool) {
	root = euler.ISqrt(base)
	perfect = (root*root == base)
	return
}
示例#2
0
文件: pr044.go 项目: d3zd3z/euler
func IsPentagonal(num int) bool {
	sq := num*24 + 1
	root := euler.ISqrt(sq)
	return (root*root == sq) &&
		((root+1)%6) == 0
}