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