>>> n = ""

>>> for x in range(1,10):

... n = n+str(x)

... print "%s x 8 + %d = %d" % (n,x,(int(n) * 8 + x))

...

1 x 8 + 1 = 9

12 x 8 + 2 = 98

123 x 8 + 3 = 987

1234 x 8 + 4 = 9876

12345 x 8 + 5 = 98765

123456 x 8 + 6 = 987654

1234567 x 8 + 7 = 9876543

12345678 x 8 + 8 = 98765432

123456789 x 8 + 9 = 987654321

>>>

>>> n = ""

>>> for x in range(1,10):

... n = n+str(x)

... print "%s x 9 + %d = %d" % (n,(x+1),(int(n) * 9 + x+1))

...

...

1 x 9 + 2 = 11

12 x 9 + 3 = 111

123 x 9 + 4 = 1111

1234 x 9 + 5 = 11111

12345 x 9 + 6 = 111111

123456 x 9 + 7 = 1111111

1234567 x 9 + 8 = 11111111

12345678 x 9 + 9 = 111111111

123456789 x 9 + 10 = 1111111111

>>>

>>>

>>>

>>>

>>>

>>> n = ""

>>> r = range(2,10)

>>> r.reverse()

>>> for x in r:

... n = n+str(x)

... print "%s x 9 + %d = %d" % (n,(x-2),(int(n) * 9 + (x-2)) )

...

9 x 9 + 7 = 88

98 x 9 + 6 = 888

987 x 9 + 5 = 8888

9876 x 9 + 4 = 88888

98765 x 9 + 3 = 888888

987654 x 9 + 2 = 8888888

9876543 x 9 + 1 = 88888888

98765432 x 9 + 0 = 888888888

# Fun with Numbers

Reply