function Next() { $y = $this->Digit(); if ($this->IsSafe($y)) { $this->z = $this->Produce($y); return $y; } else { $this->z = $this->Consume($this->x->Next()); return $this->Next(); } } } $n = $argv[1]; $i = 0; $length = 10; $pidigit = new PiDigitStream(); while ($n > 0) { if ($n < $length) { for ($j = 0; $j < $n; $j++) { printf("%d", $pidigit->Next()); } for ($j = $n; $j < $length; $j++) { print " "; } $i += $n; } else { for ($j = 0; $j < $length; $j++) { printf("%d", $pidigit->Next()); } $i += $length; }
function Next(){ $y = $this->Digit(); if ($this->IsSafe($y)){ $this->z = $this->Produce($y); return $y; } else { $this->z = $this->Consume($this->x ->Next()); return $this->Next(); } } } $n = $argv[1]; $i = 0; $length = 10; $pidigit = new PiDigitStream; while ($n > 0){ if ($n < $length){ for ($j=0; $j<$n; $j++) printf("%d",$pidigit->Next()); for ($j=$n; $j<$length; $j++) print " "; $i += $n; } else { for ($j=0; $j<$length; $j++) printf("%d",$pidigit->Next()); $i += $length; } print "\t:$i\n"; $n -= $length; } ?>