News for hackers. Stuff that matters.
Re:1/9998 = 0.0001 0002 0004 0008 0016 0032 0064 0128 0256.. by geoffhotchkiss on Wednesday January 29, 2014 @12:59PM (#7145538)
It actually doesn't break, you just have to do the carries as you would during normal addition. You have to read from right to left (1's place, 10's place, 100's place, and so on). So you're really just converting to base 10.

5th row: 1 5 10 10 5 1

Writing this a bit backwards, 1 * 1 + 5 * 10 + 10 * 100 + 10 * 1000 + 5 * 10000 + 1 * 100000 = 161051 = 11^5.

Re:1/9998 = 0.0001 0002 0004 0008 0016 0032 0064 0128 0256.. by tryeng on Wednesday January 29, 2014 @01:24PM (#7145721)
You can of course do this trick in any base. If we choose e.g. base 2^n for the n-th row of pascals triangle, we can use the following code for getting the n-th row of pascals triangle:

    def pascal(n):
      base = max(2, 2**n)
      row = (base+1)**n
      return [row/base**i % i for i in range(n+1)]
Nice, but hopelessly inefficient. :) You can also calculate a binomial coefficient the same way without any looping construct (the exponential operator does the looping for you).