Пример #1
0
 def testFailure(self):
     self.assertFalse(euler.isHexagonal(0))
     self.assertFalse(euler.isHexagonal(2))
     self.assertFalse(euler.isHexagonal(3))
     self.assertFalse(euler.isHexagonal(4))
     self.assertFalse(euler.isHexagonal(7))
     self.assertFalse(euler.isHexagonal(8))
     self.assertFalse(euler.isHexagonal(14))
     self.assertFalse(euler.isHexagonal(92))
Пример #2
0
 def testSuccess(self):
     self.assertTrue(euler.isHexagonal(1))
     self.assertTrue(euler.isHexagonal(6))
     self.assertTrue(euler.isHexagonal(15))
     self.assertTrue(euler.isHexagonal(28))
     self.assertTrue(euler.isHexagonal(45))
     self.assertTrue(euler.isHexagonal(190))
Пример #3
0
import euler as e

num = 0
diff = 1
while True:
    num += diff
    if e.isPentagonal(num) and e.isHexagonal(num) and num > 40755:
        print num
        break
    diff += 1