Example #1
0
// 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
}
Example #2
0
func IsPentagonal(num int) bool {
	sq := num*24 + 1
	root := euler.ISqrt(sq)
	return (root*root == sq) &&
		((root+1)%6) == 0
}