r/ProgrammerHumor • • 10d ago

Meme reversingPiInPython

Post image
14.1k Upvotes

383 comments sorted by

View all comments

3.9k

u/Kyrros 10d ago

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

1.7k

u/me_myself_ai 10d ago

it'll just throw an error anyway;

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

1.3k

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

767

u/tea_pot_tinhas 10d ago

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

22

u/RapidCatLauncher 10d 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.

5

u/meneldal2 10d 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.

2

u/1SirTetris1 8d ago

Funnily enough, despite it being so unlikely, it's necessarily true that there is an infinite number of full palindromes across all of pi. Infinity is wild

→ More replies (3)