Debian Codegraph @

primes/matho-mult

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/python
2
3 # Python program to multiply many large integers separated by spaces or newlines.
4 # The integers to multiply may be entered on the command-line or into standard input.
5
6 # Used by "primorial" with "matho-primes" to calculate large primorials.
7 # A primorial is the product of all primes up to a given number.
8
9 import string
10 import sys
11
12 prod = 1 # initialize product and make it an integer
13 args = sys.argv[1:]
14 if (args == []):
15 # read stdin if no command line args
16 while True:
17 try:
18 input_line = raw_input()
19 except:
20 break;
21 for s in string.split(input_line):
22 prod *= int(s)
23 else:
24 # multiply together the command-line args
25 for arg in args:
26 prod *= int(arg)
27 print prod