Skip to content

Instantly share code, notes, and snippets.

@quapka
Created October 28, 2014 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quapka/84fc9fbafbce147a939e to your computer and use it in GitHub Desktop.
Save quapka/84fc9fbafbce147a939e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from fractions import gcd
moduli = [8844679, 11316499, 13490941, 18761893, 21799573,
22862761, 48456493, 43831027, 58354333, 60785419]
GCDs = [['\\textbf{Moduli}'] + moduli]
for nA in moduli:
line = [nA]
for nB in moduli:
line.append(gcd(nA, nB))
if line[0] in [13490941, 48456493]:
#line = ['\\textcolor{blue}{'+ str(x) +'}' for x in line]
line = ['\cellcolor{blue}'+ str(x) for x in line]
GCDs.append(line)
print '\\begin{tabular}{*{11}{|c}|}\n\\hline'
for line in GCDs:
print ' & '.join([str(x).rjust(9) for x in line]) + ' \\\\ \n\hline'
print '\\end{tabular}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment