Pollyanna
Posted: Wed Dec 03, 2008 11:12 pm
Nice challenge!
Code: Select all
#!/bin/python
import math
a=[[[3,1],[5,1],[821,1],[273997,1],[7741805910970258163,1]],[[2,2],[107,1],[244219007447,1],[95966808334871,1]],[[2,2],[7,3],[919,1],[56951,1],[103160249,1],[4656410419,1]],[[2,3],[17,1],[177693403,1],[414883089729841223,1]],[[3,1],[31,1],[4951,1],[1346989159,1],[50461897989311,1]],[[7,2],[79,1],[241,1],[4271,1],[48523,1],[1051181,1],[176838479,1]],[[2,1],[1475709031,1],[12177009148932085937,1]],[[6323573,1],[4753519027288416018457,1]],[[2,1],[18164960872674393974925145111,1]]]
for i in range(0,len(a)):
n=1
for j in range(0,len(a[i])):
n*=a[i][j][0]**a[i][j][1]
s=''
for k in range(0, int(round((math.log(n,2))/(math.log(256,2))))):
s=chr(n%256)+s
n=n/256
print s