Class PiSpigot

java.lang.Object
net.okapia.osid.torrefacto.math.PiSpigot

public class PiSpigot extends Object
An unbounded spigot generator for the decimal digits of pi. Each call to nextDigit() yields the next digit in order, starting with the leading 3; the sequence has no fixed length and the BigInteger state grows as more digits are produced.
  • Constructor Details

    • PiSpigot

      public PiSpigot()
      Constructs a new PiSpigot.
  • Method Details

    • nextDigit

      public int nextDigit()
      Returns the next decimal digit of pi. Successive calls yield the digits in order, beginning with the leading 3, then 1, 4, 1, and so on.
      Returns:
      the next digit, 0 through 9
    • main

      public static void main(String... args)
      Prints the digits of pi to standard output, without end, until the process is interrupted.
      Parameters:
      args - ignored