Python Interpreters Benchmarks
x64 ArchLinux : AMD® Ryzen 7 4700U®

 performance measurements

Each table row shows performance measurements for this program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load

Read the ↓ make, command line, and program output logs to see how this program was run.

Read  benchmark to see what this program should do.

 notes

  source code

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/

# transliterated from Mike Pall's Lua program
# contributed by Mario Pernici

try:
    from gmpy2 import mpz
except ImportError:
    from gmpy_cffi import mpz
from sys import argv

try:
  N = int(argv[1])
except:
  N = 100

i = k = ns = 0
k1 = 1
n,a,d,t,u = map(mpz,(1,0,1,0,0))
while(1):
  k += 1
  t = n<<1
  n *= k
  a += t
  k1 += 2
  a *= k1
  d *= k1
  if a >= n:
    t,u = divmod(n*3 +a,d)
    u += n
    if d > u:
      ns = ns*10 + t
      i += 1
      if i % 10 == 0:
        print ('%010d\t:%d' % (ns, i))
        ns = 0
      if i >= N:
        break
      a -= d*t
      a *= 10
      n *= 10

 make, command-line, and program output logs

 Fri, 09 Sep 2022 06:05:09 GMT

COMMAND LINE:
 /usr/bin/pypy pidigits.pypy-2.pypy 10000

PROGRAM FAILED 


PROGRAM OUTPUT:

Traceback (most recent call last):
  File "pidigits.pypy-2.pypy", line 10, in <module>
    from gmpy_cffi import mpz
ImportError: No module named gmpy_cffi

Revised BSD license

  Home   Conclusions   License   Play