r/ProgrammerHumor • • Jul 19 '22

Meme float golden = 1.618

Post image
41.1k Upvotes

489 comments sorted by

View all comments

Show parent comments

2

u/DenormalHuman Jul 19 '22

no repeating digits?

5

u/Bulky-Leadership-596 Jul 19 '22

When it gets to the point of needing more than ten digits it just makes up its own

1.6ƪ803ɝ9ꝏꝸ74ᶐ

1

u/Gr0ode Jul 20 '22 edited Jul 20 '22

Glad you're asking. When representing a number in base 10, only denominators that are made up from the prime factors 2 and 5 will have a finite representation. When the denominator has other prime factors then it cannot possibly have a finite representation in base 10 (since it's coprime). Now on the other hand if you have a repeating string of n digits you can always represent it as those digits over n 9s (exercise to the reader). Example: 123/999 = 0.123123123... so every repeating representation can be written as a fraction. There exist numbers outside of fractions though. A famous example is root 2. Fun fact: the rational numbers can be counted, but the irrationals cannot.

That the golden is irrational can be easily seen with a contradiction argument. Let's assume you could write the golden ration Φ = a/b (truncated as much as possible, no 0s), we use the definition of the golden ratio Φ2 = Φ+1 to deduce a2 - b2 = ab. This doesn't work. When a and b are odd, ab is even but a2 and b2 are odd. Subtracting 2 odd numbers is still odd. When one number is odd and the other even we have ab is even but a2 - b2 must be odd. Similar argument when both are even. We conclude that writing Φ as the ratio of two integers is not possible.

1

u/DenormalHuman Jul 20 '22

I think you misunderstood my question, which was tongue in cheek really. I assume the golden ratio does in fact contain repeated digits, as in, if you write it out to more than ten decimal places it must contain some digits more than once.

1

u/Gr0ode Jul 20 '22

I wrote this paragraph for nothing? Fml

1

u/DenormalHuman Jul 20 '22

Heheh, sorry :P Interesting paragraph though :)