# Patterns in numbers

I am partial to some examples of coincidence (or not). Hint: see the left column of letters.

I tend to shy away from even faint whiffs of mysticism, numerology, and in general attaching undue weight to circumstance.  As such, I was initially a little upset when sent this link from my friend over at the fantastic Austin music blog ovrld.com.  For those who don’t wish to click, the link points out that the fraction 1/998,001 prints out the digits from 000-999, in order, except for 998.  I mean, if we look at the first 1,000,000 fractions, we’ll to find 1,000,000 decimals that might hide some patterns significant to someone – and that’s only fractions of the form 1/n.

Also, recall that if you want a repeating decimal with some pattern, there is a nice algorithm to find the associated fraction: to find the fraction equal to x = 0.19851985… (being both my day of birth and my year of birth), we notice that

10000x-x = 1985.1985… – 0.19851985… = 1985.

Then solving for leaves us with x = 1985/9999.  Here’s the thing though: this is not very pretty- the numerator is pretty big.

So I guess some kudos should go to whoever noticed this fact about 998001.  Let’s just not attach any special significance to it.

Today's filler photos come from Shiner, TX. Czech it out!

As an aside, I assume this was done by noticing that

1/98 = 0. 01 02 04 08 16 32 65 30 61 22 44 89 79 59 18 36 73 46 93 87 75 5…,

which is almost the sequence of square numbers powers of two (once you get to 128, the “1″ gets added to the “4″ in “64″, and so on), which is somewhat interesting.  Looking at higher denominators like this, you might get to

1/9801 = 0. 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 99…

Still don't know what Lady Liberty was doing in Texas...

Which might somehow suggest getting to 998001… eventually.  Finally, it turns out that this fraction is not so special, in the following way: it does not start repeating for another few thousand digits.  In particular, it goes through 2997 digits, then cycles back to the “000001002003…” pattern.

I wrote a very short Python script to play around with this sort of thing- it is a pretty quick way to perform division arbitrarily accurately, and just uses the Python function ` divmod.`

```def long_div(p,q,digs):
#finds the first digs digits of p/q, returned as a string.  p and q must be integers.
a,r = divmod(p,q)
n = str(a)+'.'
for j in range(digs-len(str(a))):
r *=10
a,r = divmod(r,q)
n += str(a)
return n```

## 5 comments to Patterns in numbers

1. Is 01 02 04 08 16 32 65 really “almost the sequence of square numbers”?

2. Fixed. Those “weren’t the exponents I was looking for”.

3. Carter says:

Man, that guy that sent you that link has such a cool blog.

Also, when I noticed the sequence of powers of two thing and the adding and all that…blew my mind. Thanks again, Colin!

4. [...] else.  Initially I kept an eye on this article thinking it would be a neat way of explaining the 1/998001 decimal expansion, though Leonid Kovalev had a great post relating this identity to a broader theory of power [...]

5. [...] else.  Initially I kept an eye on this article thinking it would be a neat way of explaining the 1/998001 decimal expansion, though Leonid Kovalev had a great post relating this identity to a broader theory of power [...]