Playing with numbers: 1/998001 and others

A post in response to Colin’s “Patterns in numbers”:

1/998001 = 0.000 001 002 003 004 005 006 007…

goes through all integers 000 through 999, skipping only 998. Maple confirms this:


This fraction made rounds on the internet a while ago.

I begin with two general claims:

  • Integer numbers are more complicated than polynomials
  • Decimal fractions are more complicated than power series

To illustrate the first one: multiplying 748 by 367 takes more effort than multiplying the corresponding polynomials,

(7x^2+4x+8)(3x^2+6x+7) = 21x^4+54x^3+97x^2+76x+56

The reason is that there’s no way for the product of 4 x and 3x^2 to “roll over” into x^4. It’s going to stay in the x^3 group. Mathematically speaking, polynomials form a graded ring and integers don’t. At the same time, one can recover the integers from polynomials by setting x=10 in 21x^4+54x^3+97x^2+76x+56. The result is 274516.

Moving on to the second claim, consider the power series

\displaystyle (*) \qquad \frac{1}{1-t}=1+t+t^2+t^3+\dots = \sum_{n=0}^{\infty} t^n

I prefer to use t instead of x here, because we often want to replace t with an expression in x. For example, setting t=2x gives us

\displaystyle \frac{1}{1-2x}=1+2x+4x^2+8x^3+\dots = \sum_{n=0}^{\infty} 2^n x^n

which is nothing surprising. But if we now set x=0.001 (and, for neatness, divide both sides by 1000), the result is

\displaystyle \frac{1}{998}=0.001\ 002\ 004\ 008\ 016\ 032 \dots

which looks like a magical fraction producing powers of 2. But in reality, setting x=0.001 did nothing but mess things up. Now we have a complicated decimal number, in which powers of 2 break down starting with “513″ because of the extra digits rolled over from 1024. In contrast, the neat power series keeps generating powers of 2 forever.

By the way, \displaystyle \frac{1}{1-2x} is the generating function for the numbers 1,2,4,8,16…, i.e., the powers of 2.

So, if you want to cook up a ‘magical’ fraction, all you need to do is find the generating function for the numbers you want, and set the variable to be some negative power of 10. E.g., the choice x=0.001 avoids digits rolling over until the desired numbers reach 1000. But we could take x=10^{-6} and get many more numbers at the cost of a more complicated fraction.

For example, how would one come up with 1/998001? We need a generating function for 1,2,3,4,…, that is, we need a formula for the power series \sum nt^n. No big deal: just take the derivative of (*):

\displaystyle \frac{1}{(1-t)^2}=\sum_{n=0}^{\infty} nt^{n-1}

and multiply both sides by t to restore the exponent:

\displaystyle (**) \qquad \frac{t}{(1-t)^2}=\sum_{n=0}^{\infty} nt^{n}

Now set t=0.001, which is easiest if you expand the denominator as 1-2t+t^2 and multiply both the numerator and denominator by 1000000. The result is

\displaystyle \frac{1000}{998001} = \sum_{n=0}^{\infty} n\,0.001^{n} = 0.001002003\dots

Dropping 1000 in the numerator is a matter of taste (cf. xkcd 163).

Let’s cook up something else. For example, again take the derivative in (**) and multiply by t:

\displaystyle \frac{t(1+t)}{(1-t)^3}=\sum_{n=0}^{\infty} n^2t^{n}

Now set t=0.001 to get

\displaystyle \frac{1001}{997002999} = 0.000\ 001\ 004\ 009\ 016\ 025\ 036\ 049\dots

Admittedly, this fraction is less likely to propagate around the web than 1/998001.

For the last example, take the Fibonacci numbers 1,1,2,3,5,8,13,… The recurrence relation F_{n+2}=F_n+F_{n+1} can be used to find the generating function, \displaystyle \frac{1}{1-t-t^2} = \sum F_n t^n. Setting t=0.001 yields

\displaystyle \frac{1}{998999} = 0.000\ 001\ 002\ 003\ 005\ 008\ 013\ 021\ 034\ 055\dots

12 thoughts on “Playing with numbers: 1/998001 and others

  1. Fantastic explanation. So I guess the answer to the question “why was 998 skipped?” is really that it was not, but there was a domino effect with one of the digits from 1000 “rolling over” onto the 999, which picked up an extra digit and “rolled over” to 998, making it look like 999.

    1. Exactly. There’s another observation that did not make the post: if a function f is represented by a power series with bounded integer coefficients, then f can be determined by evaluating it at a single point. Indeed, define g(x)=f(x)+M/(1-x) where M is a sufficiently large integer so that the coefficients of g are positive. Then evaluate g(10^{-d}) where d is sufficiently large so there’s no rolling over, and read off the coefficients.

  2. It is easy to remove the domino effects of 1/998001. Notice we want to subtract 1000\sum_{n=1001}^2000 0.001^n, 2000\sum_{n=2001}^3000 0.001^n, and so on. Upon simplification this becomes \sum_{n=1}^\infty n [10^{-3000}]^{n-1} \frac{1-10^{-3000}}{0.999 \times 10^{3000}}. Exchanging derivative and limit, we have the result as exactly \frac{1}{0.999 \times 10^{3000}}. So the “ideal” faction should be 1/998001-\frac{1}{0.999 \times 10^{3000}}

    1. You are right: \displaystyle \frac{1}{998001}-\frac{1}{999\cdot 10^{2997}} has the period that ends with 997998999, going back to 000001002003…

      That said, part of what made 1/998001 interesting is that a 6-digit input (denominator) produces a nearly perfect 3000-digit output. After correction, one gets an absolutely perfect 3000-digit output, but from a fraction with over 3000 digits in the denominator.

  3. As another remark we should not pre-assume M and d discussed in the reply of the first comment; we have no idea of the magnitude of the coefficients of the power series. Thus additional computations should be used to determine M and d first.

      1. We know a formula for \sum_{n=0}^\infty  x^n and want a formula for \sum_{n=1}^\infty n x^n. How to create this coefficient n? Taking the derivative, of course: (x^n)'=nx^{n-1}. Then multiply by n to restore the exponent to n.

        There is an approach without derivative, but it requires an algebraic trick. Observe that \sum_{n=1}^\infty n x^n is equal to the double series \sum_{m=1}^\infty\sum_{n=m}^\infty x^n. Use the geometric series formula on the inner sum to get \sum_{m=1}^\infty\frac{x^m}{1-x}, and then use the formula again to get \frac{x}{(1-x)^2}.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s