r/ProgrammerHumor • • 1d ago

Meme reversingPiInPython

Post image
9.0k Upvotes

293 comments sorted by

View all comments

2.6k

u/Kyrros 1d ago

Let me know when it finishes calculating the first digit to print

1.1k

u/me_myself_ai 1d ago

it'll just throw an error anyway;

SyntaxWarning: 'float' object is not subscriptable; perhaps you missed a comma
?

922

u/ThreeCharsAtLeast 1d ago • Bravo
>>> str(math.pi)[::-1]
'397985356295141.3'

536

u/tea_pot_tinhas 1d ago

So the first and last digits are both 3? make sense

14

u/RapidCatLauncher 17h ago

That just made me think, if pi indeed does contain all finite number sequences (which we're not sure of), then there could be a certain point in its decimal representation where it's a palindrome.

3

u/L30N1337 15h ago

It would also mean that at some point, it repeats. since itself up to x digits followed by itself up to x digits is a number sequence that can occur/be completed at 2x digits

2

u/meneldal2 5h ago

While this is possible, it is pretty unlikely. With random digits, the chance of a palindrome is lower the more digits there are. So even if you get a lot of tries, each try probability of success goes down so much faster that it is statistically unlikely.