# Distribution of Digits in Irrational Numbers

13 replies to this topic

### #1 Buffy

Buffy

Resident Slayer

• 8427 posts

Posted 13 November 2007 - 08:50 PM

I wanted to come up with a fun and frivolous but scientific topic for my 100th thread, and while I was out on my jog this afternoon the following popped into my head:

Decimal numbers come in two varieties:
• Finite decimals which have nothing but trailing zeros after some point (e.g. [imath]\frac 1 2 = 0.5[/imath])
• Infinite (or "unbounded") decimals which continue on indefinitely given some definition of how they are constructed (e.g. [imath]\frac 1 3 = 0.33333.....[/imath] or for those mathematicians out there more correctly [imath]0.\overline{3}[/imath])
This latter group can then be divided into Rational and Irrational Numbers.

Now, definitionally, Rational numbers have repeating sequences of digits, so the fraction [imath]\frac 1 3[/imath] repeats the three on and on endlessly. Conversely, irrational numbers however have random sequences that do not repeat at all.

Here's where my pondering came in: for any particular decimal number, you can create a distribution map of the digits in the decimal representation. For the finite representations, this is just counting appearances so for the number [imath]\frac 5 {32} = 0.15625[/imath] you have the distribution of digits:

0: 0
1: 1
2: 1
3: 0
4: 0
5: 2
6: 1
7: 0
8: 0
9: 0

Which is not only limited but boring to boot!

With unbounded numbers, you have an infinite number of digits, so things get a bit more interesting. In order to "compute" the distribution, you need to start working with ratios of each digit to the others. With unbounded rational numbers, this is relatively easy since you can take just the "repeating sequence" and count the occurrences of each digit and then divide by the length of the sequence, so the number [imath]\frac {41} {333} = 0.123123123... = 0.\overline{123}[/imath] has the distribution:

0: [imath]\frac 1 3[/imath]
1: [imath]\frac 1 3[/imath]
2: [imath]\frac 1 3[/imath]
3: 0
4: 0
5: 0
6: 0
7: 0
8: 0
9: 0

This is obviously a skewed distribution!

On the other hand this lovely fraction: [imath]\frac 1 {81} = 0.0123456790123… = 0.\overline{0123456789}[/imath] has the perfectly Poisson Distribution curve of:

0: [imath]\frac 1 {10}[/imath]
1: [imath]\frac 1 {10}[/imath]
2: [imath]\frac 1 {10}[/imath]
3: [imath]\frac 1 {10}[/imath]
4: [imath]\frac 1 {10}[/imath]
5: [imath]\frac 1 {10}[/imath]
6: [imath]\frac 1 {10}[/imath]
7: [imath]\frac 1 {10}[/imath]
8: [imath]\frac 1 {10}[/imath]
9: [imath]\frac 1 {10}[/imath]

When you bring in Irrational Numbers though, there's no immediately obvious way to figure this out. Being to lazy to do it right away, I thought I'd throw it out to all the math whizzes out there:

What are the distributions of digits in Irrational Numbers?

Can we make any interesting generalizations? Since the digits in an Irrational number are random, they *could* all be Poisson Distributed, but are they? How's about [imath]\pi[/imath] or e?

Any references to cool Abstract Algebra or Number Theory proofs that are relevant (or have solved this one completely!)?

Anyone want to contribute some code to test any theories?

The creator of the universe works in mysterious ways. But he uses a base ten counting system and likes round numbers,
Buffy

### #2 C1ay

C1ay

¿42?

• 6488 posts

Posted 13 November 2007 - 09:36 PM

From the looks of this page on the frequency of digits in Pi it looks to be approaching a uniform distribution.

OTOH, e does not seem to have a normal distribution according to this source.

### #3 Tormod

Tormod

Hypographer

• Members
• 14353 posts

Posted 14 November 2007 - 01:48 AM

Not sure if I understand this, but I was reminded of a book I read a while ago which discussed the distribution of prime numbers, the Riemann hypothesis and some other stuff.

Maybe you can find some relevant ideas here?

Prime number theorem - Wikipedia, the free encyclopedia

### #4 Qfwfq

Qfwfq

Exhausted Gondolier

• Members
• 6241 posts

Posted 14 November 2007 - 03:24 AM

Can we make any interesting generalizations? Since the digits in an Irrational number are random, they *could* all be Poisson Distributed, but are they?

For a given base b, given any histogram (distribution of b numbers that add to 1), there are certainly at least one, and typically infinitely many, numbers who's digits in base b have that histogram. The "number" of them isn't in general easy to express except in simple cases; it's the number of permutations over [imath]\aleph_0[/imath] elements, reduced for equivalent ones. Obviously, permutations are all equivalent in the case of a single digit, otherwise there are infinitely many non equivalent permutations.

For a rational number, the b numbers of the histogram must be rational, they needn't be for an irrational number but they may be.

Cute question, go jogging more often!

### #5 snoopy

snoopy

Understanding

• Members
• 261 posts

Posted 14 November 2007 - 05:12 AM

Hi
The poisson distribution for rational numbers is given as
f(k;λ) = e^(-λ) λ^k / k!

Where k is the actual number of occurrences and λ is the expected number
and k! is the facotrial of k
code hmm try this java code not sure if its what your looking for though.

/**Calculates an approximation of the Poisson probability. * @param mean - lambda, the average number of occurrences * @param observed - the actual number of occurences observed * @return ln(Poisson probability) - the natural log of the Poisson probability. */public static double poissonProbabilityApproximation (double mean, int observed){ double k = observed; double a = k * Math.log(mean); double b = -1.0 * mean * Math.log(Math.E); return a + b - Num.factorialApproximation(k);}/**Srivivasa Ramanuja ln(n!) factorial estimation. * Good for larger values of n. * @return ln(n!) */public static double factorialApproximation(double n){ if (n < 2) return 0; double a = (n * Math.log(n)) - n; double b = (Math.log(n * (1.0+ (4 * n * (1.0 + (2.0 * n)))))) / 6.0; return a + b + (Math.log(Math.PI) / 2.0);}

Peace

### #6 CraigD

CraigD

Creating

• 7446 posts

Posted 14 November 2007 - 03:37 PM

This reminds me of a question I read (can’t remember the source) that asked the simple question:

“Does there exists any finite sequence of digits that does not appear in some irrational number?”

For example, the digit sequence 04261960 (my birthday ) appears in $\pi$ starting at the 103245729th position after the decimal (according to The Pi-Search Page).

The base of the numeration system used appears unimportant to this question.

The assumption is that the answer to this question is “no”, but to the best of my knowledge, this is not only unproven, but nobody has much of an idea how to go about even finding an approach to a proof of it.

The question is reminiscent of Borges’s story "The Library of Babel", and Sagan’s novel “Contact”. If it’s answer is indeed, as is expected for at least some irrational number, then in the digits of some (or all) irrational number contain the text of every work that can ever be written using the Latin alphabet, including the complete works of Shakespeare, a compelling theory of everything, an engineering description of a practical fusion power plant, etc.

Following the maxim that everything involving numeration becomes as simple as it can get when done in base 2, these similar question about the normalcy (in the sense used upthread) of an irrational number can be asked:

“Does there exist an irrational number for which there exists no truncated binary representation contains an equal counts of 1s and 0s?”

“Does there exist an number L for which no truncated binary representation of a given irrational number contains equal counts of 1s and 0s greater than L?”

For example, the first question is not true of $\pi \dot= 11.0010010000111111011010101000100010000101101000110000100011_2$, as it’s first 4, 6, 8, 30, etc. digits consist of equal numbers of 1s and 0s.

These questions are related to a coin tossing question I discovered in Krauss's “Beyond Star Trek”, which asks “What is the probability that a true coin will ever produce the same # of heads & tails?” (the answer is “1, a certainty”)

### #7 Buffy

Buffy

Resident Slayer

• 8427 posts

Posted 14 November 2007 - 08:09 PM

OTOH, e does not seem to have a normal distribution according to this source.

Those are really interesting graphs C1ay! That's exactly what I was looking for. And I think its really interesting that even if [imath]\pi[/imath] does converge to Poisson, it sure takes its own sweet time in getting there, huh!

For a given base b, given any histogram (distribution of b numbers that add to 1), there are certainly at least one, and typically infinitely many, numbers who's digits in base b have that histogram.

Which would make perfect sense, because the sequences in rational numbers *always* repeat eventually, and while they can obviously get "long," "long" is always small enough to do anything in the infinite set of rational numbers!

For a rational number, the b numbers of the histogram must be rational, they needn't be for an irrational number but they may be.

Yet another reason why I think that the irrational numbers make for an interesting focus on this little topic. Its like opening a whole bunch of cans of worms!

Cute question, go jogging more often!

I do every day! But only occasionally does hitting the wall result in fun stuff. Usually its just an epiphany about a bug or an old boyfriend...

This reminds me of a question I read (can’t remember the source) that asked the simple question:

“Does there exists any finite sequence of digits that does not appear in some irrational number?”

For example, the digit sequence 04261960 (my birthday ) appears in $pi$ starting at the 103245729th position after the decimal...

Which is an irrational analogue to what Q said about rationals above...

The assumption is that the answer to this question is “no”, but to the best of my knowledge, this is not only unproven, but nobody has much of an idea how to go about even finding an approach to a proof of it.

Good! Unbroken ground! Maybe it will succumb to brute force programming! (I'm an applied mathematician, so sue me... )...

snoopy: I'm going to try to diambiguate your code sniplet, but could you post an explanation of what its supposed to *do*?

It may be irrational of me, but human beings are quite my favorite species,
Buffy

### #8 snoopy

snoopy

Understanding

• Members
• 261 posts

Posted 15 November 2007 - 02:22 AM

Hi Buffy the code snippet never turned out well enough pasted it will just type it

it calculates the approximation of the poisson probability

{if (n<2) return 0;
double a = (n * Math.log(n)) - n;
double b = (Math.log(n * (1.0+ (4 * n * (1.0 + (2.0 * n)))))) / 6.0;
return a + b + (Math.log(Math.PI) / 2.0);}

The trouble is it doesnt do much right now its just the core math
found it in a old java compiler, but I will work on it so it prints the value of n and a + b + (Math.log(Math.PI) / 2.0) alongside it.

Peace

### #9 Qfwfq

Qfwfq

Exhausted Gondolier

• Members
• 6241 posts

Posted 15 November 2007 - 02:53 AM

The assumption is that the answer to this question is “no”, but to the best of my knowledge, this is not only unproven, but nobody has much of an idea how to go about even finding an approach to a proof of it.

I'd say it's pretty obviously "no", give me a sequence of base b digits and I'll construct an infinity of irrational numbers in which it appears!

“Does there exist an irrational number for which there exists no truncated binary representation contains an equal counts of 1s and 0s?”

“Does there exist an number L for which no truncated binary representation of a given irrational number contains equal counts of 1s and 0s greater than L?”

The former ones exist, by construction, for the latter question I'm not sure of your wording. If you mean "of any given irrational number" the answer is clearly "no" if there's such a thing as normal irrationals, else it depends on the given irrational.

Which would make perfect sense, because the sequences in rational numbers *always* repeat eventually, and while they can obviously get "long," "long" is always small enough to do anything in the infinite set of rational numbers!

I'm not 100% sure where you're going, here.

However, I would say that if the number is rational, it always has a period (which may be the digit 0) whereas any other sequence of its digits (comprising ones previous to the period) needn't eventually repeat.

I do every day!

Knew you'd say that! But ya know what I meant.

Which is an irrational analogue to what Q said about rationals above...

Actually that's just a corollary of what I said, and I meant it about all reals.

### #10 CraigD

CraigD

Creating

• 7446 posts

Posted 06 April 2008 - 10:56 AM

On the other hand this lovely fraction: 1/81 = 0. 0123456790123… = 0. 0123456789 ... has the perfectly Poisson Distribution curve of:
0: 1/10

Despite it being months old, we’ve not yet noticed that this is wrong!

$\frac 1 {81} = 0.\overline{0123456\mathbf{79}} \not= 0.\overline{0123456\mathbf{789}}$. It's missing the 8.

To get the latter repeating fraction, we need the much less lovely fractions $\frac{123456789}{9999999999}$ or, in canonic form, $\frac{13717421}{1111111111}$.

Any fraction of the form $\frac{a}{10^{10n}-1}$ where $a$ is a simply normal positive integer $10n$-digit integer is simply normal.

I don’t know what the loveliest fraction (that is, with the fewest numerator and denominator digits) with a perfectly even distribution of digits, and can’t right off think of a not-too computationally intense (9! or more iterations) way to find it.

### #11 Qfwfq

Qfwfq

Exhausted Gondolier

• Members
• 6241 posts

Posted 07 April 2008 - 09:44 AM

Despite? Gee I'd say either it was noticed at the time or it remained forever unpunished!
I mean, I would have thought!

Certainly though, sure enough, it's sufficient to consider what the prime factors of 9999999999 are and it becomes obvious that the fraction can't be 1/81 exactly.

Now Buffy, kneel down on those dehydrated chick-peas!!!!!!!

### #12 CraigD

CraigD

Creating

• 7446 posts

Posted 11 April 2008 - 01:36 AM

I don’t know what the loveliest fraction (that is, with the fewest numerator and denominator digits) with a perfectly even distribution of digits, and can’t right off think of a not-too computationally intense (9! or more iterations) way to find it.

What was I thinking? 10! is only 3628800, just a few seconds on a vaguely modern computer for a little program like this MUMPS one:
r XPERMR,XGCDR

n (R) s R(1)=(R(1),(("",(R,","))," ",",")) f N=2:1:(R,",") s (R,",",1,N)=(R,",",2,N)_","_(R,","),(R(1),",",N)=(R(1),",",N)+1#N q:(R(1),",",N) ;XPERMR: permuter

n (R) f  q:'R  s R=(R,",",2)#R_","_+R ;XGCDR: Euclid’s GCD algorithm

k R,C s C=999,(R,R0)="0,1,2,3,4,5,6,7,8,9" f  s A=R,R=(R,",")_",9999999999" x XGCDR s R=(R,",",2),F=(A,",")/R_"/"_(9999999999/R),F=(F)_","_F s:(F<C:1,F>C:0,1:(F,",",2)<(C,",",2)) C=F w:F=C C,! s R=A x XPERMR q:R=R0 ;find shortest fraction
According to it (though not formally proven) the loveliest (that is, smallest) fraction form of a repeating decimal number with a perfectly even distribution of digits (AKA simply normal) is $\frac{114}{9091} = 0.\overline{0125398746}$

### #13 Qfwfq

Qfwfq

Exhausted Gondolier

• Members
• 6241 posts

Posted 11 April 2008 - 08:58 AM

According to it (though not formally proven) the loveliest (that is, smallest) fraction form of a repeating decimal number with a perfectly even distribution of digits (AKA simply normal) is $frac{114}{9091} = 0.overline{0125398746}$

Errrrrrrr...

Did your algorithm compare it with things such as:

$0.\overline{00112255339988774466}$

$0.\overline{00112233445566778899}$

$0.\overline{90817265534938271406}$

$0.\overline{01234567899876543210}$

$0.\overline{000111222333444555666777888999}$

$0.\overline{0123456789832091847569876543210}$

and so on?

### #14 CraigD

CraigD

Creating

• 7446 posts

Posted 12 April 2008 - 01:50 PM

Did your algorithm compare it with things such as:

$0.overline{00112255339988774466}$

No. All it did was generate all the permutations of the 10 digits and find the canonic (AKA simplest, lowest) form of the fraction of each 10 (or 9, when the first digit is 0) digit number over $10^{10}-1 = 9999999999$.

Qfwfq asks a wise question. A quick check of repeating part of the decimal expansion of all proper fractions with denominators less than the 9091 found in post #12 reveals a new “most lovely” simply normal number:
$\frac1{61} = 0.\overline{016393442622950819672131147540983606557377049180327868852459}$

It’s even smaller (in the magnitude of its numerator and denominator) than the $\frac1{81}$ in post 1 that started this search.

All of fractions $\frac{a}{61}, \, 1 \le a < 61$ are simply normal, as are those of many other denominators, such as 131 and 183. Many but not all of these denominators are prime.

This lead to a remarkable theorem:

If $a$ is a simply normal integer, $a*b$ is a simply normal integer for all integers $b, \, 1 \le b < a$.

PS: Here’s the MUMPS code used:
r XF,XC,XC(1)
k R,Q f R=1:1 s Q(R)=ND,N=N#D q:(R(N))  s R(N)=R,N=N*B ;XF: find repeating digits
n I,C x XC(1) s C=(C(0)),D=0 f I=1:1:B-1 s D=(C(I))-C q:D ;XC: set D=true if simply normal
k C f I=R(N)+1:1:R s C(Q(I))=(C(Q(I)))+1 ;XC(1)
s B=10 f D1=1:1 f N1=1:1:D1-1 s N=N1,D=D1 x XF i R(N)=1,R-R(N)#B=0 x XC i 'D w N1,"/",D1,! r R ;find fraction with simply normal repeating decimals