Sure. But make the connection with the 5s. It isn't just copying that pi. It is getting there in a very non-direct route.
You can do the same with 9s, for the same reason you might be picking up on if you don't trivialize that there is another pi in the mix. You can't escape it when you're talking about circular things, regardless.
Every proof or non-coincidental estimate of pi (ie: not 22/7) out there has pi embedded in the proof somehow. Dismissing it is like saying the Pythagorean theorem is bollocks because they also add up to the same number of degrees. Even though you're describing it in lengths, the degrees don't disappear. This code is very much like that. Just not triangular.
The thing is that in this particular case it does in fact just copy the pi. You're essentially calculating radians(x)*180/x, which by definition is equal to pi. The radians function is doing all the heavy lifting, unlike say using the Taylor series or some other approximation approach.
It is doing this: sin(555555555555555555), where the 5's are an x number of 5s that increasingly converges on pi, and calculates the correct decimal placement.
It's not (quite) as trivial as just copying the pi.
Nope, that is not what it does.
First, sin(x) ~= x for small x. Second, 1000.../555... = 1.8. Neither of these have anything to do with pi. With these in mind, the program can be simplified as
The main and only reason you get pi in the end is that the radians function is defined as radians(x) = pi * x / 180, which requires knowing the value of pi to begin with.
So this program is basically an equivalent of
multiply_the_argument_by_pi(555) / 555
except with a few layers of completely unnecessary math on top of it to obscure the magic trick.
You can do the same with 9s, for the same reason you might be picking up on if you don't trivialize that there is another pi in the mix. You can't escape it when you're talking about circular things, regardless.
Every proof or non-coincidental estimate of pi (ie: not 22/7) out there has pi embedded in the proof somehow. Dismissing it is like saying the Pythagorean theorem is bollocks because they also add up to the same number of degrees. Even though you're describing it in lengths, the degrees don't disappear. This code is very much like that. Just not triangular.