why is number 5 unique

Of all the prime numbers (numbers that are not divisible by any other whole number except 1), 5 has a unique property, and I wonder if there’s a reason.

All the other primes (here’s a pointer to a site that gives you 30K of them … http://www.newdream.net/~sage/old/numbers/primeodd.htm) share a common feature. For any prime number n, the reciprocal of the number (1/n) will never compute exactly, will always present a repeating pattern, and the pattern will repeat in (n-1) digits.

Example - prime number 7. Reciprocal is 0.142857 142857 142857 …
Example - prime number 11. Reciprocal is 0.09090909 0909090909 0909090909
Example - prime number 29. Reciprocal is 0.0344827586206896551724137931 0344827586206896551724137931 0344827586206896551724137931

However, the reciprocal of 5 is 0.2. It doesn’t repeat.

Any ideas why.

I would think that it’s because it is a factor of the number system’s base (10). I wonder if the reciprocal of 7 comes out exact in base-14 math. I wish I wasn’t suffering from Sunday morning brain, or I’d look into it.

By the way, your shared property breaks slightly with 3, since it’s reciprocal’s decimal representation repeats in 1 digit, not 2.

Ignore that last sentence. I see from your 11 example that I was interpreting things too strictly.

One more comment on my conjecture: 10’s other prime factor, 2, also has an exact reciprocal. That’s got to be important, though my synapses can’t make the leap right now.

Saltire’s on the right track. For a number n’s reciprocal to be terminating, it has to be exactly represented in k digits.
1/n = a/10^k - Assuming it terminates, n is prime, a and k are both integers
10^k = a * n - Multiplying both sides by n * 10^k
Now if we look at the prime factorization of both sides, the left is all 2 and 5, while the right has at least one more factor, n. As long as n isn’t 2 or 5, that equality can’t be satisfied by integers.

So I’ll generalize and say that a prime’s reciprocal will terminate if you represent it in a base where the prime is a factor.

Your other observation, that the representation repeats in n-1 digits, I haven’t worked through. I’ll think on it.

Hal

It is, in fact, the case that the representation of 1/n in base b is terminating if and only if n can be expressed solely as the product of factors of b. In addition, it is also true that the representation of 1/n always repeats within (at most) n-1 digits. I’ve seen proofs of both of these, but not in years.

The property you noticed has nothing at all to do with primality; it is a consequence of place-value notation in base 10.

The fact that only reciprocals of powers of two have exact binary representations is important in numerical computation, by the way.

As for the repeating, think about performing long division to calculate the representation of any rational, p/q. There are only q-1 non-zero remainders possible, and as soon as you repeat a remainder, you repeat the pattern.

Last time.

Well, it bears, er, repeating …

I confess I had an idea about the influence of working in a Base-10 system, but I was afraid of making even more of an arse of myself than already in asking the question.

I’m fascinated by KellyM’s statement

Taking that to it’s logical conclusion, would reciprocals of powers of five also have exact quintenary representations. Does this mean …

  1. That one day (given the coming of a modern-day Boole to create the logic in base 5) all (binary based) computers would become suddenly redundant, and
  2. This is actually the secret project Bill Gates is working on since retiring as CEO of MicroSoft.

A related point:

Just like a reciprocal will be terminating if it is a factor of the base of the number system (i.e., 2 and 5 in base 10, or 2 3 4 and 6 in base 12), so too:

The rule that for any multiple of 9, the total of its digits will also be a multiple of 9, also results from 9’s position in the base-10 system. In other words, the rule holds true for other bases, for whatever is one less than the base. Example: In base eleven, the number nine hundred is represented by 749 [=(7121)+(411)+(9*1)], whose digits add to twenty, which is divisible by ten.

Nah. There are good reasons why base two won’t become obsolete as long as electronic computers are used.

KellyM was alluding to the fact that a large part of floating point error is due to the fact that in binary, unless you’re working with reciprocals of powers of two (or their multiples), you’ll have rounding error because the number won’t have a terminating representation. For instance, if you ask a computer to add together .1 and .1, it’ll say .2, but that’s not the exact value it’s storing.

You know I’ve often wondered the same. My coach actually gave me a choice to pick a number for my soccer jersey, and I chose 5.
(oh well, 10 was taken :)) and 5 isn’t my favourite number, nor do I associate it as lucky (although it didn’t proove to be either), but well yea, I’ve known others too, who have an inclination or fetish for 5.

Surely the decimal expansion always repeats for any fraction?

Use long division to divide 1 by any number n. At each stage you are finding the greatest multiple of n less than some number, which is at most 10n, since it’s the previous remainder (<n) with a naught on the end. There are only so many such numbers, so eventually you’ll get have used the same one twice. Then the same sequence of remainders follows and hence the decimcal expansion repeats. Of course, if you get to remainder 0, you stop, since you know all further remainders will be 0; we can treat 0.2 ad 0.2000…

Same thing should work for any base.

In base 10 2 and 5 (and any multiples of only 2s and 5s) terminate because they divide 10. Similarly for any other base (eg. 2,3,6,4,9,etc terminate base 6).

I think there’s a fundamental difference between repeating (which happens for primes) and recurring. An example of a recurring fraction would be 1/12 = 0.0833333*

Doesn’t make any difference to us mathematicians. Either it’s all zeroes after a certain point, or it’s not. Before that point…who cares?

It durn well should matter. If rampisad’s observation is correct, that for every prime n, 1/n repeats after n-1 digits, and if this property is true only for primes, then it’s a quick and certain test of primality. Need I point out that there is currently no such test, and that such a test would be extremely useful in, say, cryptography?

Actually, it turns out that this is not a feature unique to primes. I just did some checking, and 1/33 = 0.03, which would repeat in blocks of 32. It’s still an interesting property, though.

OK, Chronos, you got me.

However, I might point out that 1/33 repeats after fewer than 32 iterations. It would be interesting to see what kind of numbers n have reciprocals that repeat after exactly n - 1 digits.

I have some number theory to do, I think.

Of course, 1/11 = .09 kinda ruins any hope of that being a necessary and sufficient condition for primality, but if it were either of the two, that would be nice.

That, and there was that recently published algorithm which was O([symbol]b[/symbol][sup]12[/sup]). O([symbol]b[/symbol][sup]3[/sup]) if ERT is true, I think.

chronos says

As Saltire points out I was being very specific in my OP that “the pattern will repeat in (n-1) digits”. In fact, can be stated better that the pattern will repeat in some factor of (n-1) digits.