Write a program to calculate the first 500 digits of pi, meeting the rules below:

  • It must be less than 500 characters in length.
  • It cannot include “pi”, “math.pi” or similar pi constants, nor may it call a library function to calculate pi.
  • It may not use the digits “3”, “1” and “4” consecutively.
  • It must execute in a reasonable time (under 1 minute) on a modern computer.

The shortest program wins.