We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 591f900 commit fd08ee9Copy full SHA for fd08ee9
1 file changed
src/flint/types/fmpz.pyx
@@ -688,6 +688,17 @@ cdef class fmpz(flint_scalar):
688
k = fmpz_is_perfect_power(v.val, self.val)
689
return k != 0
690
691
+ def is_square(self):
692
+ r"""
693
+ Return True if perfect square and False otherwise.
694
+
695
+ >>> fmpz(25).is_square()
696
+ True
697
+ >>> fmpz(101).is_square()
698
+ False
699
+ """
700
+ return fmpz_is_square(self.val) != 0
701
702
def partitions_p(n):
703
r"""
704
Returns `p(n)`, the number of partitions of `n`, as an *fmpz*.
0 commit comments