r/learnprogramming • • Apr 28 '22

If everything is ultimately binary, does't that just make programs a specific number?

I did the CS50 course a while ago and they covered binary in there. I did binary back in 2006 when I was at college too so understood the logic behind it already. It's either on or off!

When a C program compiles, it goes through it's phases and compiles to assembly and then ultimately machine code i.e binary.

Let's say our program is 5,000,000 pages of 1's and 0's. All of those 1's and 0's make up a single number....albeit a super long number.

Does that mean that the entire Linux operating system, for example, can be represented by an actual number?

If so, why are we not storing programs as a number because that would take up less space than the 5,000 pages of 1's and 0's.

110101000101011111011011111110111100 = 57000443836 in decimal. So why don't we store programs in decimal and convert that to 1's and 0's in real time?

Storage would be much less. Is that how compression works?

These may be crazy questions but it just entered my head earlier when thinking about what the binary of a program can represent.

Even shorter than decimal is HEX.... So why don't we store programs in Hex?

Any help appreciated on this one so I can wrap my head around it.

1.7k Upvotes

346 comments sorted by

View all comments

Show parent comments

241

u/l_am_wildthing Apr 28 '22

every possible number combination exists somewhere in pi

Not to be pedantic but this is a misconception about the infinite-ness of pi... just because it is infinite and non-repeating doesnt mean it has every possible number. 1.101001000100001000001... is infinite and non-repeatable but doesnt contain every number. Pi is obviously different but the same applies

81

u/matthewapplle Apr 29 '22

Something something monkey typewriter Shakespeare??

69

u/InnerBanana Apr 29 '22

This comment is one of the failed attempts from that very experiment

0

u/[deleted] Apr 29 '22

[deleted]

10

u/goahnary Apr 29 '22

All of them actually. Including this one. These monkeys are hilariously self-aware while… also not self aware??

Does the monkey learn and grow as it types? If it does I think it would take it significantly less time to learn/type Shakespeare.

28

u/p43- Apr 29 '22

Let me neatly summarise this whole comment thread:

7463662637483720304057371719

6

u/Mollyarty Apr 29 '22

Or more time, if the monkey learns and grows it'll likely develop its own style that might not align with Shakespeare

2

u/Vonkampf Apr 30 '22

Maybe not, maybe they got the complete works of Shakespeare on like the 3rd attempt and just stopped…

→ More replies (1)

3

u/james_connor Apr 29 '22

But have they read Shakespeare?

2

u/bladedspokes Apr 29 '22

All the world's a stage, and all the monkeys merely players. They have their entrances and their exits; and one monkey in his time plays many parts.

→ More replies (2)

83

u/captainAwesomePants Apr 29 '22

Totally fair. We also have to show that pi is normal, and although I'd bet it is, that is certainly not a given.

33

u/Sufficient_Drop5013 Apr 29 '22

It may very well be a misconception, but you can't prove it's not true.

40

u/jcb088 Apr 29 '22

Until he can! If he can! Maybe that's his life's work!

This conversation might be the start of something incredible!

39

u/schoolmonky Apr 29 '22

Depending on what exactly you mean by "it," you totally can, and /u/l_am_wildthing did.

If by "it" you meant the statement "Pi doesn't contain every possible number," then yes, that's currently believed to be false, and therefore unprovable.

But if you read carefully, that's not the statement that /u/l_am_wildthing is arguing against. What they actually say is that the facts that a number (in this case, pi) is infinite and non-repeating do not imply that it contains every possible number. He's not making a claim about whether pi has all numbers in it, but instead about the logical relationship between whether pi is infinite and non-repeating and whether pi contains all numbers.

1

u/Smooth_Measurement_1 Apr 30 '22

So many replies on this Pi thing! I can't believe that Pi contains every number in the world. The possibility of having a long row of 0's and 1's is quite slim given there are another batch of numbers to mix in there.

→ More replies (7)

30

u/nimbledaemon Apr 29 '22

If you start believing everything you can't prove to be false, you're going to end up believing a lot of bullshit.

-1

u/Sufficient_Drop5013 Apr 29 '22

Exactly, no one can prove that God doesn't exists, nor anyone can prove that he/she/it Does exists. In the end, it's just a matter of faith. So if I have to choose, I choose to have faith in pi.

→ More replies (2)

24

u/Putnam3145 Apr 29 '22

Sure, but you can't claim it like it's a known fact either. Lots of people suspect P != NP but I'm not gonna go around proclaiming it.

→ More replies (3)

13

u/chrisrrawr Apr 29 '22

Not quite. Pi's non-repeptition applies to patterns. If you take your example and create a sequence of 1's and 0's and ensure there's no regular pattern, you will in fact create a sequence in which exists a binary representation of every possible number, in every possible order.

37

u/protienbudspromax Apr 29 '22

No this is false. In math everything needs to be proved formally to cover all cases before it can be considered true. And till now there is no proof that pi do infact contain every possible sequence of numbers.

Yes they do not follow any pattern and it would seem likely that given infinite time and length pi would contain all combinations of numbers, but there is no proof it does.

Until it is formally proved you can't say this is 100% the case. Go to r/math and ask this question you are going to get a lot of answers all saying this same thing.

ex: You tell me a number containing million digits and claim that it exist. I ask you to show me. You need to be able to prove this for all infinite combination of numbers using enumeration (perhaps impossible) or using proofing techniques.

14

u/schoolmonky Apr 29 '22

You'd need to define what you mean by "pattern", and as soon as you do it would no longer be obvious that pi doesn't repeat "patterns."

2

u/Txampi Apr 29 '22

Is not a misconception.We don’t know if pi has this property, but it’s likely to be true.

1

u/Smooth_Measurement_1 Apr 30 '22

That's an interesting concept. Do you think there will be a long line of single digits in Pi at some point in its life?

For example 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

I think that's quite a rare possibility and the odds are extremely slim....

-7

u/FountainsOfFluids Apr 29 '22

I would like you to pick a number and then prove pi does not contain it.

28

u/MikeGlambin Apr 29 '22

While choosing a number that it doesn’t contain does prove it doesn’t contain all numbers, the inability to prove it doesn’t contain a number doesn’t mean it contains it and certainly doesn’t mean it contains all possible combination of numbers.

I am not saying it does or doesn’t I am actually now fascinated by the question.

I would love to read an actual proof for either side.

→ More replies (9)
→ More replies (3)
→ More replies (6)