Akhilesh Trivedi

Ranch Hand

Posts: 1608

posted 4 years ago

I was reading this article

http://java.dzone.com/articles/finding-2013-pi

I don't think if "2013" really occurs in pi.

pi = 3.1428571...

and it shall again repeat 428571 after that. Am I missing anything ?

http://java.dzone.com/articles/finding-2013-pi

I don't think if "2013" really occurs in pi.

pi = 3.1428571...

and it shall again repeat 428571 after that. Am I missing anything ?

Keep Smiling Always — My life is smoother when running silent. -paul

[FAQs] [Certification Guides] [The Linux Documentation Project]

Matthew Brown

Bartender

Posts: 4568

9

posted 4 years ago

The decimal expansion of pi never repeats. It's an irrational number (which means it cannot be expressed as a fraction).

You may be getting it confused with 22/7, which is a common

You may be getting it confused with 22/7, which is a common

*approximation*to pi. But it's not precise. The first digits to pi are actually 3.14159265358979323... (which is as far as I remember it without looking it up!)
posted 4 years ago

Since it is irrational, it goes on forever and there is no pattern. That means that you can pick ANY pattern, of ANY length, and EVENTUALLY you will find it. this site has the first 100k digits, and 2013 appears no less than eleven times. If you keep expanding the value out, the number of times 2013 appears will approach infinity.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Matthew Brown

Bartender

Posts: 4568

9

posted 4 years ago

That may be true about Pi, but it's seriously non-trivial to prove, and I'm not sure it has actually been proved yet. But I don't think it would be hard to find a counter-example that disproves it in general.

Take this simple example: define PIE as the number with the same decimal expansion as PI, except that every time you find the sequence '2013' in it, you remove it (recursively, if necessary, so you would remove '20201313' completely). Now I'm as close to certain as I can be without having a cast-iron proof that PIE would be irrational. But it also doesn't contain the sequence 2013 anywhere.

fred rosenberger wrote:Since it is irrational, it goes on forever and there is no pattern. That means that you can pick ANY pattern, of ANY length, and EVENTUALLY you will find it.

That may be true about Pi, but it's seriously non-trivial to prove, and I'm not sure it has actually been proved yet. But I don't think it would be hard to find a counter-example that disproves it in general.

Take this simple example: define PIE as the number with the same decimal expansion as PI, except that every time you find the sequence '2013' in it, you remove it (recursively, if necessary, so you would remove '20201313' completely). Now I'm as close to certain as I can be without having a cast-iron proof that PIE would be irrational. But it also doesn't contain the sequence 2013 anywhere.

Matthew Brown

Bartender

Posts: 4568

9

posted 4 years ago

To pick another counter-example, there exist irrational numbers that are clearly not random. They can have a pattern, as long as it isn't a repeating pattern. For example:

0.101001000100001000001... (where the number of 0s between 1s increases by one each time)

But Pi isn't like that. Probably

0.101001000100001000001... (where the number of 0s between 1s increases by one each time)

But Pi isn't like that. Probably

Campbell Ritchie

Sheriff

Posts: 54053

130

posted 4 years ago

well...can you prove that 0.101001000100001000001... is irrational, first of all. I'm not saying it is or isn't...I'm just saying that is not immediately obvious to me. Pi being irrational is also not immediately obvious to me, but it HAS been proved.

And how can you COMPLETELY remove something from an infinite series of digits? And until you CAN prove that your number PIE is irrational, your example is moot. "I have a number that may or may not be irrational, but I'm going to use it to prove that an irrational number doesn't contain 2013".

;-)

I do, however, take your point. Perhaps I was a little over-zealous in my statement.

Matthew Brown wrote:To pick another counter-example, there exist irrational numbers that are clearly not random. They can have a pattern, as long as it isn't a repeating pattern. For example:

0.101001000100001000001... (where the number of 0s between 1s increases by one each time)

But Pi isn't like that. Probably

well...can you prove that 0.101001000100001000001... is irrational, first of all. I'm not saying it is or isn't...I'm just saying that is not immediately obvious to me. Pi being irrational is also not immediately obvious to me, but it HAS been proved.

And how can you COMPLETELY remove something from an infinite series of digits? And until you CAN prove that your number PIE is irrational, your example is moot. "I have a number that may or may not be irrational, but I'm going to use it to prove that an irrational number doesn't contain 2013".

;-)

I do, however, take your point. Perhaps I was a little over-zealous in my statement.

Matthew Brown

Bartender

Posts: 4568

9

posted 4 years ago

As I understand it, yes, probably. Pi may well be "normal", which means no finite sequence of numbers appears more often than others of the same length. Which is an even stronger condition than saying all sequences appear an infinite number of times. But it's been very resistant to proving these things for certain.

See, for example, http://www.askamathematician.com/2009/11/since-pi-is-infinite-can-i-draw-any-random-number-sequence-and-be-certain-that-it-exists-somewhere-in-the-digits-of-pi/

See, for example, http://www.askamathematician.com/2009/11/since-pi-is-infinite-can-i-draw-any-random-number-sequence-and-be-certain-that-it-exists-somewhere-in-the-digits-of-pi/

Matthew Brown

Bartender

Posts: 4568

9

posted 4 years ago

Actually, that's relatively easy. All rational numbers terminate in a repeated sequence of a finite number of digits*. That number doesn't. Therefore it's irrational.

* Proof: just go through the algorithm for calculating the decimal expansion of p/q where p and q are integers (multiply p by 10, divide by q, take the remainder and continue). As soon as you hit a number you've had before the sequence will repeat from that point. And since you're working modulo q, the number of possible remainders is bounded by q. p/q must therefore have a repeating terminal sequence of no more than q digits.

fred rosenberger wrote:

well...can you prove that 0.101001000100001000001... is irrational, first of all. I'm not saying it is or isn't...I'm just saying that is not immediately obvious to me. Pi being irrational is also not immediately obvious to me, but it HAS been proved.

Actually, that's relatively easy. All rational numbers terminate in a repeated sequence of a finite number of digits*. That number doesn't. Therefore it's irrational.

* Proof: just go through the algorithm for calculating the decimal expansion of p/q where p and q are integers (multiply p by 10, divide by q, take the remainder and continue). As soon as you hit a number you've had before the sequence will repeat from that point. And since you're working modulo q, the number of possible remainders is bounded by q. p/q must therefore have a repeating terminal sequence of no more than q digits.

Campbell Ritchie

Sheriff

Posts: 54053

130

posted 4 years ago

It also says π contains a binary representation of Britney Spears’ DNA.Matthew Brown wrote: . . . See, for example, http://www.askamathematician.com/2009/11/since-pi-is-infinite-can-i-draw-any-random-number-sequence-and-be-certain-that-it-exists-somewhere-in-the-digits-of-pi/

It is sorta covered in the JavaRanch Style Guide. |