Fractions with Special Digit Sequences  

This page discusses fractions whose decimal expansion has a nice pattern or a recognizable sequence, like 1/99 = 0.0101010101... and 1/9801 = 0.0001020304...

Contents

The magic of 1/7

The Simplest Sequences

The Fibonacci Reciprocals

  A Simple Way to Find a Magic Fraction

  A More Fundamental Understanding

  Working It Out Through Algebra

  A Proof For Any Base

Through the Looking Glass: Generating Functions

  Reversing the Process

Generating Function Methods

Generating Functions Through Differentials

Using the OEIS

The magic of 1/7

Some fractions can be written exactly with a finite number of digits (a "terminating decimal"): 1/2 = 0.5, 1/4 = 0.25. Others go on forever (a repeating decimal): 1/3=0.333333..., 1/6=0.166666... All of these can be said to be fairly "simple".

The smallest number that doesn't give a simple fraction is 7:

1/7 = 0.142857142857...       4/7 = 0.571428571428...
2/7 = 0.285714285714...       5/7 = 0.714285714285...
3/7 = 0.428571428571...       6/7 = 0.857142857142...

I have highlighted 6 digits in each of these to show the "magic" property of 1/7: All of these fractions have the same set of 6 digits in the same order. They differ only in which of the 6 digits comes first.

If you consider the process of long division, you will see that 6 is the most number of digits that any of these fractions could have. Consider 1/7 for example:

10/7 is 1 with a remainder of 3,
30/7 is 4 with a remainder of 2,
20/7 is 2 with a remainder of 6,
60/7 is 8 with a remainder of 4,
40/7 is 5 with a remainder of 5, and
50/7 is 7 with a remainder of 1.

The remainder must be a number from 0 to 6, because we're dividing by 7 and the remainder is always smaller than the divisor. The remainder cannot be 0 because that would make a terminating decimal. So there can only be 6 different remainders in the long division, and 1/7=0.142857... uses all 6 of them.

In general, the repeating decimal of a number 1/N must repeat every N-1 digits, or fewer. The numbers N for which it is the maximum N-1 digits are called "primes P with 10 as a primitive root", or primes P such that 10 is a primitive root modulo P. The next one after 7 is 17, because 1/17 has a 16-digit repeating decimal:

1/17 = 0.05882352941176470588235294117647...

After 7 and 17, we have 19, 23, 29, 47, 59, 61, 97, and so on (Sloane's sequence A001913).

The Simplest Sequences

An integer sequence can be as simple as the "all zero sequence" A000004: 0,0,0,0,0,... or as inscutable as A002410 related to the unsolved Riemann hypothesis: 14, 21, 25, 30, 33, 38, ...

In repeating decimals the simplest sequence is the "all 1's sequence" A000012: 1,1,1,1,1,1,1,1,... This is the repeating decimal of 1/9: 0.11111111... Those who experiment with a pocket calculator usually try 1/99 and discover it has a similar decimal: 0.0101010101... Unsurprisingly, 1/999 is 0.001001001... and so on.

Similar experiments soon reveal some other 6-digit repeating decimals related to 1/7 and 1/13 (including 1/21 = 0.047619047619... and 1/39=025641025641...) and the 2-digit patterns related to 1/11 (like 1/22 = 0.04545454545...). Also of interest are 1/27 = 0.037037037... and 1/37 = 0.027027027... (see my entry for the number 999). Probably the most interesting of these are 1/49 = 0.0204081632... (which we will get to later) and 1/81 = 0.0123456790123456790...

The digits of 1/81 are almost like the non-negative integers (A001477) but 8 is missing, and of course it goes from 9 back to 0 (no 10, 11, etc.). But actually 8 is there, and 10 and the higher integers are there too. To see them, we have to visualize 1/81 as a sum like this:

0.0 0.01 0.002 0.0003 0.00004 0.000..5 0.000...6 0.000... 7 0.000... 8 0.000... 9 0.000... 10 0.000... 11 0.000... 12 0.000... 13 0.000... 14 ... .. ... + 0.000... .. ---------------------------- 0.01234679012345679012...

Each integer is shifted one digit further to the right, so the 9 and 10 add up like "90+10" generating a carry that adds to the 8, making a 9 in the digit after ...567.

I first noticed (on a pocket calculator) that 1/9 is 0.11111111... and the obvious thing (obvious to me anyway) was to try dividing this by 9, and I got 0.0123456790123...

Since 81 is 92, one might think of looking at the reciprocal of 992. You get a pleasant result:

1/9801 = 0.00010203040506070809101112131415161718192021222324252627...

Here we have the non-negative integers again, but there is enough room for the two-digit numbers to appear intact. As you might expect, 1/998001 gives 0.000001002003004005..., with 3 digits for each integer.

The Fibonacci Reciprocals

I learned about the above from books and my own experimentation on a pocket calculator. A little while later, perhaps in high school I read about 1/89 = 0.011235955...

89 is a Fibonacci number, and the digits of 1/89 start with the first few Fibonacci numbers: 0, 1, 1, 2, 3, 5. The rest of the digits are Fibonacci numbers too, added together like this:

0.0 0.01 0.001 0.0002 0.00003 0.000..5 0.000...8 0.000...13 0.000... 21 0.000... 34 0.000... 55 0.000... 89 0.000... 144 0.000... 233 0.000... 377 ... .. ... + 0.000... .. ---------------------------- 0.01123595505617977528...

The fact that 89 itself is a Fibonacci number is a happy coincidence, and isn't necessary. Just like with 1/9801 and 1/998001, there are longer versions of this "Fibonacci reciprocal":

1/9899 = 0.0001010203050813213455...

1/998999 = 0.000001001002003005008013021034055089144233377...

How did I find those? I could try a bunch of things on a calculator to see what seems to give the right answer, but there are much more direct ways to do it.

A Simple Way to Find a Magic Fraction

The connection between 89 and these longer numbers 9899 and 998999 might be obvious, but suppose we didn't know it? They could be found pretty easily just by assuming that there is a "Fibonacci fraction" and performing the division in reverse:

1/0.0001010203050813213455 = 9899.00000000000000886455...

We can use the same trick to find other magic fractions. The Fibonacci numbers are an exponential sequence; how about a fraction that gives us the powers of 2?

1/0.01020408163264 = 98.000000000125...

It looks like 1/98 would give us the powers of 2. Similar experiments show that 1/998, 1/9998 and so on also work. Each of these gives more powers of 2 (assuming you have a high-precision calculator to get lots of digits), making it pretty clear it is not just a coincidence.

A More Fundamental Understanding

Returning to the first Fibonacci example 1/89, I wondered is there was a "fundamental reason" why it is 1/89 and not some other fraction. A simple experiment is to use the simple test to find the "Fibonacci fraction" in other bases. We use base 10, but there must be Fibonacci fractions in other bases. Using something like the Unix program bc, it is easy to do calculations in any base. Fairly easily I found that:

in base 5, the Fibonacci fraction is 1/19 = 0.0112...
in base 6, it is 1/29 = 0.0112...
in base 7, it is 1/41 = 0.01123...
in base 8, it is 1/55 = 0.01123...
in base 9, it is 1/71 = 0.01123...
in base 10, it is 1/89 = 0.011235...

and so on. It soon became clear that

in base b, it is 1/(b2-b-1) = 0.0112358...

So the special thing about 89 is that it is 100-10-1.

Another fact that became clear through similar experiments was that the fractions b/(b2-b-1) and b2/(b2-b-1) work equally well. For example in base 10 we have 100/89 = 1.1235... which is just the same digits with the decimal point shifted over.

It's nice to have an explanation for the "89 coincidence" and see that the same fractions happen in other bases than decimal, but there remains the question of what the relationship is between the Fibonacci sequence and the fractions 1/(b2-b-1), b2/(b2-b-1), etc.

Working It Out Through Algebra

Let's use "base 100", which is just base 10 taken two digits at a time. We already know the answer is 1/9899 or 100/9899 or 10000/9899, but let's imagine we don't know this and try to find the fraction from its "Fibonacci decimal expansion".

N/D = 0.0101020305081321...

Dividing by 100 will give us the same thing shifted 2 digits to the right:

N/100D = 0.0001010203050813...

Multiplying by 100 will give us the same thing shifted 2 digits to the left:

100N/D = 1.0102030508132134...

We also know (from the definition of Fibonacci numbers) that we can subtract two Fibonacci numbers and get another Fibonacci number. So we can subtract N/D from 100N/D and get:

99N/D = 1.0001010203050813...

the thing on the right is just 1 plus N/100D. So we can write:

99N/D = 1 + N/100D

N/D is a fraction, and like any fraction we get the same value by multiplying the numerator and denominator by any arbitrary number (for example, 1/2 = 3/6 = 7/14, and so on). So we really don't need two variables N and D, it's just their ratio we're trying to find. We don't have to solve for both N and D, we just want a formula for one in terns of the other.

First get everything over the same denominator:

9900N/100D = (100D + N)/100D

Multiply by 100D:

9900N = 100D + N

Combine the N's:

9899N = 100D

Dividing both sides by D, then by 9899, gives us the ratio N/D:

N/D = 100/9899

which of course is the fraction and decimal we started with:

N/D = 100/9899 = 0.0101020305081321...

A Proof For Any Base

The previous example was for base 100, but it doesn't have to be just for a specific number base. We can do the same thing in any base b.

Using F0, F1, F2, F3, etc. to represent the Fibonacci numbers 0, 1, 1, 2, ..., we start with

N/D = F0.F1F2F3F4F5F6F7F8...

and we can work through the entire solution as above. "100" is b, "99" is b-1, "9900" is b2-b, and "9899" becomes b2-b-1. We end up with the answer:

N/D = b/(b2-b-1) = F0.F1F2F3F4F5F6F7F8...

It will also be useful to multiply both sides by b2, or equivalently by 1/b-2. This gives us

Nb2/D = b/(1-b-1-b-2)

Through the Looking Glass: Generating Functions

Let's convert the symbolic digits "F1.F1F2F3F4F5F6..." into what they really represent, using the standard definition of Positional notation:

F0.F1F2F3F4F5F6... = F0 + F1b-1 + F2b-2 + F3b-3 + F4b-4 + F5b-5 + F6b-6 + ...

This is a sort of "polynomial" with negative exponents. Let's put this into the solution we worked out above, for any base b:

b/(b2-b-1) = F0 + F1b-1 + F2b-2 + F3b-3 + F4b-4 + F5b-5 + F6b-6 + ...

Those negative exponents are a bit odd. But b is a variable, so we can change it. The nice thing about variables is that they can have values that wouldn't be convenient to work with directy.

What if the "base" is something small, like 1/10 or 1/100? We don't normally think of numbers as being in "base 1/100", but with a variable b and Fi for all the "digits", it doesn't really matter. Let's define x = 1/b, then we can turn all the negative exponents on the right-hand-side into positive powers of x. The left side has to change too, so we get:

x-1/(x-2-x-1-1) = F0 + F1x + F2x2 + F3x3 + F4x4 + F5x5 + F6x6 + ...

We don't want any negative exponents. It's easy to get rid of the ones on the left-hand-side: just multiply by x2/x2:

x/(1-x-x2) = F0 + F1x + F2x2 + F3x3 + F4x4 + F5x5 + F6x6 + ...

We now have something that might be familiar to some readers, who may have learned about Taylor series approximations. The thing on the right is an infinite polynmial in x with coefficients F0, F1, F2 and so on. The thing on the left is a function of x (that's not just a normal polynomial).

If this is true, then the Fibonacci numbers are the coefficients of the Taylor series expansion of x/(1-x-x2). Let's see if this is true. Using the excellent website Wolfram Alpha, put this into the box:

Series[x/(1-x-x^2), {x,0,8}]

You'll get:

x + x2 + 2 x3 + 3 x4 + 5 x5 + 8 x6 + 13 x7 + 21 x8 ...

where the coefficients of x are the Fibonacci numbers. What Wolfram Alpha is telling us is that for values of x near 0, the value of this (infinite) polynomial is close to the value of 1/(1-x-x^2). For example if x=0.2, x/(1-x-x2) is about 0.263157... and the first part of the polynomial (x+x2+2x3+3x4+5x5+8x6) adds up to 0.262912.

Since we defined x to be 1/b, where b is the base of the decimal fraction, let's go back to our original b=100 fraction. That means x is 1/100 or 0.01.

Putting 0.01 in for x, you can see that:

x/(1-x-x2) = 0.01/(1-0.01-0.0001) = 0.01/(0.9899) = 100/9899

There's our fraction 100/9899.

Going back to the original base 10, let x be 0.1, and we get:

x/(1-x-x2) = 0.1/(1-0.1-0.01) = 0.1/(0.89) = 10/89

10/89 is 0.112359..., which is the same as 1/89 shifted over 1 digit.

More Examples of Series Expansions and Repeating Decimals

Here's another example. In Wolfram Alpha again, put in:

Series[1/(1-x), {x,0,8}]

You get the polynomial:

1 + x + x2 + x3 + x4 + x5 + x6 + x7 + x8 + . . .

The coefficients are the "all 1's sequence" A000012: 1,1,1,1,1,1,1,1,... which is the repeating decimal of 1/9, mentioned above. In base 10, b = 10 and x = 1/b = 0.1. So the value of 1/(1-x) is 1/(1-0.1) = 1/0.9 = 10/9. For base 100, we let x = 0.01 and we get 1/(0.99) = 100/99 = 1.0101010101...

If we use 1/(1-2x) instead:

Series[1/(1-2x), {x,0,8}]

we get:

1 + 2x + 4x2 + 8x3 + 16x4 + 32x5 + 64x6 + 128x7 + 256x8 + . . .

where the coefficients are A000079, the powers of 2. Predictably, if we set x = 1/b = 0.01, the value of 1/(1-2x) is 1/0.98 = 100/98 = 50/49. We can subtract 1 = 49/49 to get the simple fraction mentioned near the beginning of this article, 1/49 = 0.0204081632...

If 1/9 is 0.111111... and 1/81 is 0.0123456..., you might guess that the sequence of positive integers A000027 comes from 1/(1-x)2, and you'd be right:

Series[1/(1-x)^2, {x,0,8}]

1 + 2x + 3x2 + 4x3 + 5x4 + 6x5 + 7x6 + 8x7 + 9x8 + . . .

using x = 1/b = 0.01, 1/(1-x)^2 is 1/0.9801 = 10000/9801 = 1.020304050607... The decimal is shifted 4 digits as compared to the original example 1/9801.

To get the even numbers A005843 we can just double the fraction that gives us the positive integers: 20000/9801 = 2.040608101214...

Similarly, for multiples of 3 we just use 30000/9801 = 3.060912151821... 9801 is a multiple of 3, so this one can be reduced to 10000/3267.

Here is a less obvious example:

Series[x*(1+x)/(1-x)^3, {x,0,8}]

x + 4x2 + 9x3 + 16x4 + 25x5 + 36x6 + 49x7 + 64x8 + . . .

This is sequence A000290, the squares. Using x = 0.01 again, the fraction is x(1+x)/(1-x)3 = 0.0101/0.970299 = 10100/970299 = 0.010409162536...

If you do a Taylor (or Maclaurin) series expansion of a function F(x) and get a sequence of coefficients Si, then F(x) is said to be the "generating function" of the sequence Si.

The application of generating functions specifically to decimal expansions of fractions is discussed by Smoak [1] using the Fibonacci fractions 1/89, 1/9899, etc. and explaining them in terms of the generating function 1/(1-x-x2). (This differs from the more commonly accepted generating function x/(1-x-x2). Smoak's version defines F0=1, F1=1, F2=2, and so on; the standard definition starts with F0=1. See OEIS A000045.)

Reversing the Process

We have now established that:

What remains is to find a way of converting any sequence Si into the "generating function" F(x) that we can use to find the fraction.

This task can be very difficult, and there is no general solution that will work for all sequences, or even for all well-defined sequences. There is no generating function for the prime numbers, for example.

There are specific rules for certain types of sequences. From the above examples you can see that 1/(1-Nx) gives the powers of N, and N/(1-x)2 gives the multiples of N. The rule that generalizes N, N2, N3 and so on uses Eulerian numbers, which aren't particularly obvious but at least have been figured out.

Mishima [3] uses the Lucas numbers in an example showing how to find the generating function for a sequence. We start with just the sequence:

Li = 2, 1, 3, 4, 7, 11, 18, ... (OEIS A000032)

Make it into a polynomial by making each Li a coefficient of xi:

Li = 2 + x + 3x2 + 4x3 + 7x4 + 11x5 + 18x6 + ...

Perform algebraic transformations on this, such that the definition of the sequence can be invoked to cancel out the infinite series of powers of x. In this particular case we can multiply by x and by x2. The purpose is to shift the coefficients over to higher powers of x:

x Li = 0 + 2x + x2 + 3x3 + 4x4 + 7x5 + 11x6 + ...

x2 Li = 0 + 0x + 2x2 + x3 + 3x4 + 4x5 + 7x6 + ...

Line up the original and the transformed versions so that all powers of x are above one another:

Li = 2 + x + 3x2 + 4x3 + 7x4 + 11x5 + 18x6 + ...
x Li = 0 + 2x + x2 + 3x3 + 4x4 + 7x5 + 11x6 + ...
x2 Li = 0 + 0x + 2x2 + x3 + 3x4 + 4x5 + 7x6 + ...

Now the definition of the sequence can be used to make most of the terms cancel out. In this particular case, you do this by subtracting the second and third row from the first row. For example, in the x3 column we get 4x3-3x3-x3 = 0. All that remains is:

Li - xLi - x2Li = 2 + x - 2x = 2 - x

Solve for Li:

(1-x-x2) Li = 2-x

Li = (2-x) / (1-x-x2)

Now we have a generating function for the Lucas numbers. This can be verified directly by typing Series[(2-x)/(1-x-x^2),{x,0,8}] into Wolfram Alpha, or by making a fraction by setting x to 0.01:

x=0.01

(2-x)/(1-x-x2) = 1.99/0.9899 = 19900/9899 = 2.01030407111829...

If you compare this to the process I used above for the Fibonacci numbers, you can see that the manipulation of decimal fractions, like computing 1.0102030508132134...-0.0101020305081321..., was essentially the same technique.

Generating Function Methods

Powers of N

For powers of x, a method very similar to the above is used. Take the powers of 2 for example:

Pi = 1 + 2x + 4x2 + 8x3 + 16x4 + ...

2x Pi = 0 + 2x + 4x2 + 8x3 + 16x4 + ...

Pi - 2x Pi = 1

(1 - 2x) Pi = 1

Pi = 1/(1-2x)

The similar method works for the powers of 3 giving 1/(1-3x) and so on.

Powers of 1 (the All-Ones Sequence)

By the same method, the "powers of 1" are easily shown to be 1/(1-x), which will be useful elsewhere.

Adding Two Sequences

Two generating functions can be directly added together to get the generating function of a sequence that is the sum of two other sequences. So the sequence 2, 3, 5, 9, 17, 33, ... which is 1 plus the powers of 2, has the generating function:

1/(1-x) + 1/(1-2x)

To add these together we can convert both fractions to the same denominator, which gives (1-2*x)+(1-x)/((1-x)(1-2x)) = (2-3x)/(1-3x+2x2). If x=0.01 we get 1.97/0.9702 = 19700/9702 = 2.0305091733...

Generating Function for the Integers

To derive the generating function for A000027 = 0, 1, 2, 3, 4, 5, ... requires the addition rule. Let Oi be the all-ones sequence with generating function 1/(1-x), and Ii be the sequence of integers.

Ii = 0 + x + 2x2 + 3x3 + 4x4 + 5x5 + ...

x Ii = 0 + 0x + x2 + 2x3 + 3x4 + 4x5 + ...

Oi = 1 + x + x2 + x3 + x4 + x5 + ...

We subtract xIi and Oi from Ii to get:

Ii - x Ii - Oi = -1

and we can substitute the generating function for Oi which we already know to be 1/(1-x):

(1-x) Ii - 1/(1-x) = -1

(1-x) Ii = 1/(1-x) - 1 = (1-(1-x))/(1-x) = x/(1-x)

Ii = x/(1-x)2

To get a fraction we can use x = 0.01, so x/(1-x)2 = 0.01/0.9801 = 100/9801 = 0.01020304050607...

Multiplication by a Constant

The even numbers are just 2 times the integers, and the generating function for them is just 2 times the generating function for the integers:

2x/(1-x)2

As a fraction this is 200/9801 = 0.02040608101214...

Odd Numbers

For the odd numbers we just have to add the all-ones sequence Oi to the even numbers. The generating function is:

1/(1-x) + 2x/(1-x)2 = (1-x)/(1-x)2 + 2x/(1-x)2 = ((1-x)+2x)/(1-x)2 = (1+x)/(1-x)2

as a fraction, (1+x)/(1-x)2 = 1.01/0.9801 = 10100/9801 = 1.03050709111315...

The Squares

The squares are the sequence 1, 4, 9, 16, 25, 36, 49, ... (OEIS A000290). I gave its generating function without explanation earlier, but now we can derive it using techniques already shown. Let Si be the squares, Oi be the odd numbers, and note that the difference between two squares is an odd number.

Si = 0 + x + 4x2 + 9x3 + 16x4 + 25x5 + ...

x Si = 0 + 0x + x2 + 4x3 + 9x4 + 16x5 + ...

Oi = 1 + 3x + 5x2 + 7x3 + 9x4 + 11x5 + ...

x Oi = 0 + x + 3x2 + 5x3 + 7x4 + 9x5 + ...

This time xSi plus xOi is exactly equal to Si:

Si - xSi - xOi = 0

Since Oi is known we can solve for Si:

(1-*x)Si = xOi = x(1+x)/(1-x)2

Si = x(1+x)/(1-x)3

and this is indeed the generating function I gave earlier.

The Cubes

Deriving the generating function for the cubes A000578 is similar but lengthier process requiring that we first derive generating functions for two other sequences (such as A008458 followed by A003215). The answer turns out to be x(1+4x+x2)/(1-x)4. Using x=0.0001 we can express the sequence as the decimal fraction x(1+4x+x2)/(1-x)4 = 0.000100040001/0.9996000599960001 = 1000400010000/9996000599960001 = 0.00010008002700640125...

Generating Functions Through Differentials

Tom Davis [2] uses calculus to derive the generating functions for the squares.

The Squares, More Directly

Deriving the generating function for the squares can be done much more quickly if you know how to take the deriviative of a polynomial. Starting with the generating function for A000027:

Ii = x/(1-x)2 = 0 + x + 2x2 + 3x3 + 4x4 + 5x5 + ...

We just need to take the deriviative with respect to x:

d/dx Ii = d/dx x/(1-x)2 = d/dx 0 + x + 2x2 + 3x3 + 4x4 + 5x5 + ...

To take the deriviative of x/(1-x)2 we can expand the denominator to (1-2x-x2) and use the quotient rule:

d/dx x/(1-x)2 = ((1-2x-x2) - x(-2-2x)) / (1-2x-x2)2
= (1 - 2x - x2 + 2x + 2x2) / (1-x)4
= (1-x2) / (1-x)4
= (1-x) (1+x) / (1-x)4
= (1+x) / (1-x)3

The deriviative of the infinite polynomial can be worked out term by term. For example the deriviative of the 2x2 term is 4x. We get:

1 + 4x + 9x2 + 16x3 + 25x4 + ...

This polynomial has the squares A000290 as coefficients, so (1+x) / (1-x)3 must be its generating function. But all the terms are off by one: we want 0 + x + 4x2 + ... To get this we simply multiply both sides by x:

x(1+x)/(1-x)3 = 0 + x + 4x2 + 9x3 + 16x4 + 25x5 + ...

The Cubes, Much More Directly

Using the same differentiation method we can get the generating function for the cubes. Again we expand the numerator and denominator of x(1+x)/(1-x)3 and use the quotient rule:

d/dx (x+x2)/(1-3x+3x2-x3) = ((1-3x+3x2-x3)(1+2x) - (x+x2)(-3+6x-3x2)) / (1-x)6
= (1 - 3x + 3x2 - x3 + 2x - 6x2 + 6x3 - 2x4 + 3x - 6x2 + 3x3 + 3x2 - 6x3 + 3x4) / (1-x)6
= (1 + 2x - 6x2 + 2x3 + x4) / (1-x)6
= (1 + 4x + x2) / (1-x)4

The last step requires factoring the polynomial 1+2x-6x2+2x3+x4, which can be done with the aid of a symbolic maths package like Macsyma or on Wolfram Alpha with "Factor[1+2*x-6x^2+2x^3+x^4]".

The differential of the infinite polynomial is again quite easy to do, and again the result is off by one term, so we need to multiply both sides by x.

Beyond the cubes the expanding and factoring gets to be a bit unwieldy to do by hand, but the whole thing can be done all at once in Macsyma. Just for fun I'll do the generating functions for the 4th powers A000583 and the 5th powers A000584:

(%i1) x*factor(ratsimp(diff(x*(1+x)/(1-x)^3, x))); 2 x (x + 4 x + 1) (%o1) ---------------- 4 (x - 1) (%i2) x*factor(ratsimp(diff(%,x))); 2 x (x + 1) (x + 10 x + 1) (%o2) - ------------------------- 5 (x - 1) (%i3) x*factor(ratsimp(diff(%,x))); 4 3 2 x (x + 26 x + 66 x + 26 x + 1) (%o3) --------------------------------- 6 (x - 1)

The minus sign in the second of these is eliminated by changing (x-1)5 to (1-x)5.

Using the OEIS

The techniques described so far can be used to derive the generating function, and therefore a rational fraction, for a large variety of integer sequences including constants raised to the power of N, N raised to a constant power, sequences defined in terms of previous terms (as the Fibonacci and Lucas sequences are), and anything combining two or more of the above.

However, many of these will take a lot of work to work out, and many sequences have already been analyzed by others, and their generating functions have been worked out. These can often be found in the Online Encyclopedia of Integer Sequences.

Let's find the fraction whose digits will give us the 4th powers: 1, 16, 81, 256, 625, 1296, ... Looking this up on OEIS we find A000583. In the FORMULA section we find "G.f.: x*(1+11*x+11*x^2+x^3)/(1-x)^5." which tells us that the generating function is x(1+11x+11x2+x3)/(1-×)5. Using x=0.0001, the function gives us:

x(1+11x+11x2+x3)/(1-x)5 = 0.0001001100110001 / 0.99950009999000049999 = 10011001100010000 / 99950009999000049999 = 0.000100160081025606251296....

Let's try one that doesn't fit any of the forms we discussed so far. This sequence might be called "three steps forward, two steps back":

0,3,1,4,2,5,3,6,4,7,5...

I looked it up on OEIS and found a sequence, with a generating function:

OEIS: A084964

Generating function: (2-2x+x2)/((1-x)(1-x2))

Letting x=0.01:

(2-2x+x2)/((1-x)(1-x2)) = (2-0.02+0.0001) / ((1-0.01)(1-0.0001)) = 1.9801 / 0.989901 = 1980100 / 989901 = 2.00030104020503060407050806...

Two more examples:

The sequence 2n + 3n is: 2, 5, 13, 35, 97, 275, 793, 2315, ... (OEIS A007689). The generating function is (2-5x)/((1-2x)(1-3x)); using the 4-digit base b=10000, the fraction comes out to 19995 / 99950006 = 0.000200050013003500970275...

A slightly different version is 2n + 3(n-1), or more precisely 2n+3n/3-0n/3. This is OEIS A085279: 1, 3, 7, 17, 43, 113, 307, 857, 2443, ..., its generating function is (1-2x-2x2)/((1-2x)(1-3x)), which produces the fraction 99979998 / 99950006 = 1.000300070017004301130...

Both of these involve the denominator 9998*9997 which is 10000-2 times 10000-3.

Non-Rational Fractions

Some integer sequences have generating functions that do not work out to a rational fraction. These might still be fairly interesting because of their decimal expansion. For example, the Catalan numbers are sequence A000108: 1, 1, 2, 5, 14, 42, 132, ... This sequence has the generating function (1-√1-4x)/2x. So if x=0.0001, (1-√1-4x)/2x is (1-√0.9996)/0.0002 = (10000-√99960000)/2 = 5000-√24990000 = 1.000100020005001400420132...

Dividing by 100 and reqlizing that 2499 = (50-1)(50+1), we get the far easier to remember:

50 - √49×51 = 0.010001000200050014004201320429...

which is easily expanded to:

500 - √499×501 = 0.001000001000002000005000014000042000132000429001430004862016796...


Footnotes

[1] James Smoak, A Magic Trick from Fibonacci, College Math. Journal 34(1) pp 58-60 (2003).

[2] Tom Davis, Fractions and Decimals, 2005.

[3] Hisanori Mishima, Remarkable patterns (web page)


Robert Munafo's home pages on HostMDS   © 1996-2012 Robert P. Munafo.   about   contact   Google+   mrob27   @mrob_27

This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. Details here s.13