def test_mul_sequence_factorial(self): n = 10 self.assertEqual(combinatorics.factorial(n), \ bigops.list_to_int(\ bigops.mul_sequence(( bigops.int_to_list(d) for d in xrange(1, n+1) )) ) )
def test_mul_sequence_trivial(self): self.assertEqual(1, bigops.list_to_int(bigops.mul_sequence([]))) for num in xrange(0, 1000, 13): self.assertEqual(num, bigops.list_to_int(\ bigops.mul_sequence(\ [bigops.int_to_list(num)] ) ) )
def main (power): digits = bigops.mul_sequence( (bigops.int_to_list(2) for d in xrange(1, power+1)) ) return sum(digits)
def main (n): # calculate factorial digits = bigops.mul_sequence(( bigops.int_to_list(d) for d in xrange(1, n+1) )) return sum(digits)
def gen_sequence(lastNum): for i in xrange(1, lastNum+1): print i yield bigops.mul_sequence(( bigops.int_to_list(i)[-10:] for d in xrange(1, i+1) ))