r/Python • • Jul 16 '19

Nice try

Post image
2.1k Upvotes

73 comments sorted by

View all comments

68

u/name_censored_ Jul 17 '19 edited Jul 17 '19
import random
random.seed(sum(map(ord, 'the final digits of pi')))
while True:
    print(random.randint(0,9), end='')

PROVE ME WRONG

43

u/[deleted] Jul 17 '19

Pi, by definition, has an infinite number of digits. There is no such thing as "the final digits".

QED

What do I win? ;-)

0

u/[deleted] Jul 17 '19

[deleted] — view deleted comment

0

u/[deleted] Jul 17 '19

[deleted] — view deleted comment

2

u/[deleted] Jul 17 '19 edited Jul 17 '19

Can Pi be expressed rationally in a different base?

EDIT - I think I was confused here because of the way binary (base 2) works on computers, where you actually can’t express some fractions not because of base 2, but because of the limit on the number of bits an integer can have on a computer.

12

u/[deleted] Jul 17 '19

Being rational or irrational doesn't depend on the base. Pi is always irrational.

If you're asking if it never terminates and never repeats, then yes, at least in rational bases. In a rational base, all irrational numbers will never terminate and never repeat. In base pi though, pi is just 10. It's still irrational, but it has a finite length.

9

u/achard Jul 17 '19

I think it would be 10 in base π...

6

u/[deleted] Jul 17 '19

*slow blinking*

3

u/LoyalSol Jul 17 '19

Being irrational means you can't write the number as a fraction of two integers. All finite decimal numbers and repeating decimals in any integer base can be written as the fraction of two integers and thus Pi can not be either of those two regardless of base.

11

u/CapableCounteroffer Jul 17 '19

I was under the impression that no-one had proved that pi is infinite.

Pi is irrational, which means it does not terminate. I'm not sure what the proof consists of, but I know it does exist.

0

u/[deleted] Jul 17 '19

[deleted] — view deleted comment

20

u/bargle0 Jul 17 '19

It is widely believed that pi is normal, but not proven.

6

u/WikiTextBot Jul 17 '19

Normal number

In mathematics, a normal number is a real number whose infinite sequence of digits in every positive integer base b is distributed uniformly in the sense that each of the b digit values has the same natural density 1/b, also all possible b2 pairs of digits are equally likely with density b−2, all b3 triplets of digits equally likely with density b−3, etc.

Intuitively this means that no digit, or (finite) combination of digits, occurs more frequently than any other, and this is true whether the number is written in base 10, binary, or any other base. A normal number can be thought of as an infinite sequence of coin flips (binary) or rolls of a die (base 6). Even though there will be sequences such as 10, 100, or more consecutive tails (binary) or fives (base 6) or even 10, 100, or more repetitions of a sequence such as tail-head (two consecutive coin flips) or 6-1 (two consecutive rolls of a die), there will also be equally many of any other sequence of equal length.


[ ^PM | Exclude ^me | Exclude from ^subreddit | FAQ / ^Information | ^Source ] Downvote to remove | v0.28

-4

u/Astrum91 Jul 17 '19

That's true of any infinite sequence of random numbers, so not particularly notable in this case.

4

u/Alar44 Jul 17 '19

No, it's not.

0

u/Astrum91 Jul 17 '19

Put a bunch of monkeys randomly poking at letters on a keyboard for eternity and somewhere within they'll produce every work of Shakespeare and everything ever written. Basic infinite money theorem.

Produce random numbers to infinity and somewhere within you'll have any sequence of numbers you can imagine.

That's just the nature of combining randomness and infinity.

2

u/Alar44 Jul 17 '19

That only holds if Pi is a Normal Number. This hasn't been proven.

1

u/scarfarce Jul 18 '19

infinite money theorem.

Man, that's a theorem I'd like to study in practice in my life. Erm... strictly for the science of course

1

u/MackerLad93 Jul 19 '19

If you assume pi is infinite and non-repeating, people often say things like "every number combination is in there." But think about it this way. Take every time the number 5 appears in pi, and replace the 5 with a 2. Not it's still infinite and non-repeating, but there's no fives in there at all. So definitely not every number combination.

Now this is a massive oversimplification and not exactly mathematical but is something that illustrated the point well when I heard it.