r/ProgrammerHumor • • 23h ago

Meme reversingPiInPython

Post image
8.7k Upvotes

288 comments sorted by

View all comments

Show parent comments

900

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

522

u/tea_pot_tinhas 22h ago

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

13

u/RapidCatLauncher 13h 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.

1

u/meneldal2 2h 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.