def testClicked(self):
        try:
            # Make sure inputs are valid integers
            n = int(self.input_n.text())
            k = int(self.input_k.text())

            result = fermat.prime_test(n, k)

            if result == 'prime':
                prob = fermat.probability(k)
                self.output.setText(
                    '<i>Result:</i> {:d} <b>is prime</b> with probability {:5.5f}.'
                    .format(n, prob))
            elif result == 'carmichael':
                self.output.setText(
                    '<i>Result:</i> {:d} is a <b>Carmichael number</b>.'.
                    format(n))
            else:  # Should be 'composite'
                self.output.setText(
                    '<i>Result:</i> {:d} is <b>not prime</b>.'.format(n))

        # If inputs not valid, display an error
        except Exception as e:
            self.output.setText('<i>ERROR:</i> inputs must be integers!')
            print(str(e))
    def testClicked( self ):
        try:
            # Make sure inputs are valid integers
            n = int( self.input_n.text() )
            k = int( self.input_k.text() )

            result = fermat.prime_test(n,k)

            if result == 'prime':
                prob = fermat.probability(n,k)
                self.output.setText( '<i>Result:</i> {:d} <b>is prime</b> with probability {:5.5f}.'.format(n,prob) )
            elif result == 'carmichael':
                self.output.setText('<i>Result:</i> {:d} is a <b>Carmichael number</b>.'.format(n))
            else: # Should be 'composite'
                self.output.setText('<i>Result:</i> {:d} is <b>not prime</b>.'.format(n))

        # If inputs not valid, display an error
        except Exception as e:
            self.output.setText('<i>ERROR:</i> inputs must be integers!')