wood burning stoves 2.0*
The moose likes General Computing and the fly likes 2013 in pi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "2013 in pi" Watch "2013 in pi" New topic
Author

2013 in pi

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
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 ?


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

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 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!)
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11153
    
  16

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

Joined: Apr 06, 2010
Posts: 4343
    
    8

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

Joined: Apr 06, 2010
Posts: 4343
    
    8

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
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37953
    
  22
Surely 2013 occurs infinitely often in the digits of π?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11153
    
  16

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

Joined: Apr 06, 2010
Posts: 4343
    
    8

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/
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

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

Joined: Oct 13, 2005
Posts: 37953
    
  22
It also says π contains a binary representation of Britney Spears’ DNA.
 
Consider Paul's rocket mass heater.
 
subject: 2013 in pi
 
Similar Threads
How many hours do you sleep every day?
Can you tell what is wrong with this loop?
IE6 must die!
need clarification in ocmjea
Need help with doing a calculation in Java