Beispiel #1
0
 def test_with_numbers_in_base_ten(self):
     self.assertTrue(solution.is_narcissistic('32164049651'))
     self.assertFalse(solution.is_narcissistic('6325629'))
Beispiel #2
0
 def test_with_numbers_in_higher_bases_with_digits_greater_than_9(self):
     self.assertTrue(solution.is_narcissistic('A', 11))
     self.assertTrue(solution.is_narcissistic('C60E7', 16))
Beispiel #3
0
 def test_default_base_is_ten(self):
     self.assertTrue(solution.is_narcissistic('153'))
Beispiel #4
0
 def test_with_numbers_in_lower_bases(self):
     self.assertTrue(solution.is_narcissistic('1', 2))
     self.assertFalse(solution.is_narcissistic('11', 5))
     self.assertTrue(solution.is_narcissistic('13', 7))
Beispiel #5
0
 def test_with_with_numbers_in_higher_bases_with_digits_less_than_9(self):
     self.assertFalse(solution.is_narcissistic('765', 15))
     self.assertTrue(solution.is_narcissistic('192', 23))
     self.assertFalse(solution.is_narcissistic('9632', 36))
Beispiel #6
0
 def test_default_base_is_ten(self):
     self.assertTrue(solution.is_narcissistic('153'))
Beispiel #7
0
 def test_with_numbers_in_base_ten(self):
     self.assertTrue(solution.is_narcissistic('32164049651'))
     self.assertFalse(solution.is_narcissistic('6325629'))
Beispiel #8
0
 def test_with_numbers_in_higher_bases_with_digits_greater_than_9(self):
     self.assertTrue(solution.is_narcissistic('A', 11))
     self.assertTrue(solution.is_narcissistic('C60E7', 16))
Beispiel #9
0
 def test_with_with_numbers_in_higher_bases_with_digits_less_than_9(self):
     self.assertFalse(solution.is_narcissistic('765', 15))
     self.assertTrue(solution.is_narcissistic('192', 23))
     self.assertFalse(solution.is_narcissistic('9632', 36))
Beispiel #10
0
 def test_with_numbers_in_lower_bases(self):
     self.assertTrue(solution.is_narcissistic('1', 2))
     self.assertFalse(solution.is_narcissistic('11', 5))
     self.assertTrue(solution.is_narcissistic('13', 7))
Beispiel #11
0
    def test_is_narcissistic(self):
        
        self.assertFalse(solution.is_narcissistic('10'))

        self.assertTrue(solution.is_narcissistic('223', 4))

        self.assertTrue(solution.is_narcissistic('0'))

        self.assertTrue(solution.is_narcissistic('1'))
        
        self.assertFalse(solution.is_narcissistic('C00C9', 16))

        self.assertTrue(solution.is_narcissistic('54748'))

        self.assertTrue(solution.is_narcissistic('5A07C', 16))

        self.assertTrue(solution.is_narcissistic('13579', 16))

        self.assertTrue(solution.is_narcissistic('124030', 5))

        self.assertTrue(solution.is_narcissistic('570', 9))

        self.assertFalse(solution.is_narcissistic('103'))

        self.assertTrue(solution.is_narcissistic('122', 3))
        
        self.assertTrue(solution.is_narcissistic('570', 9))
        
        self.assertTrue(solution.is_narcissistic('5A47C', 16))
        
        self.assertTrue(solution.is_narcissistic('12205', 7))
Beispiel #12
0
    def test_is_narcissistic2(self):
 
        self.assertFalse(is_narcissistic('999'))
 
        self.assertTrue(is_narcissistic('0'))
 
        self.assertTrue(is_narcissistic('407'))
 
        self.assertFalse(is_narcissistic('470'))
 
        self.assertFalse(is_narcissistic('ZZF02', 36))
 
        self.assertTrue(is_narcissistic('223', 4))
 
        self.assertTrue(is_narcissistic('115132219018763992565095597973971522400'))
 
        self.assertTrue(is_narcissistic('122', 3))
 
        self.assertTrue(is_narcissistic('124031', 5))
 
        self.assertTrue(is_narcissistic('12205', 7))
 
        self.assertTrue(is_narcissistic('45', 9))
 
        self.assertTrue(is_narcissistic('12344AA12A721803422912A8AA4963568083A268456A4', 11))
 
        self.assertTrue(is_narcissistic('15079346A6B3B14BB56B395898B96629A8B01515344B4B0714B', 12))