Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- # To launch the file : python <thisfile>.py
- # or ./<thisfile>.py with exec rigths given to the script
- from PIL import Image
- import sys, math
- # Thanks to C-sharp anon, i didnt have to write them by hand :D
- RSA100c = 1522605027922533360535618378132637429718068114961380688657908494580122963258952897654000350692006139
- RSA100a = 37975227936943673922808872755445627854565536638199
- RSA100b = 40094690950920881030683735292761468389214899724061
- RSA100d = 39020571855401265512289573339484371018905006900194
- RSA100e = 61218444075812733697456051513875809617598014768503
- RSA100f = 16822699634989797327123095165092932420211999031886
- RSA100n = 14387588531011964456730684619177102985211280936
- RSA100x = 1045343918457591589480700584038743164339470261995
- RSA100x_plus_n = 1059731506988603553937431268657920267324681542931
- # Not used. Using d=int(math.floor(math.sqrt(c))) instead
- # Maybe check later if python not able to handle big number
- # But no reason so far
- def bigIntegerSqrt(bigint):
- n = 0; p = 0
- if bigint == 0 : return 0
- high = bigint >> 1; low = 0
- while high > (low + 1):
- n = (high + low) >> 1
- p = n * n
- if bigint < p:
- high = n
- elif bigint > p:
- low = n
- else:
- break
- if bigint == p:
- return n
- else:
- return low
- def createTheEnd(path, theend, i_max=512, x_min=0, y_min=0, x_max=64, y_max=64):
- # Thanks to the other Anon, you saved me a lot of time :)
- #img = Image.new( 'RGB', (abs(x_min)+x_max,abs(y_min)+y_max), "black") # create a new black image
- img = Image.new('RGB', (1024, 1024), "black")
- pixels = img.load() # create the pixel map
- for i in range(0,i_max):
- for j in range(0,i):
- # Variable computation
- # using ; to compress the code
- a = i - j ; b = i + j ; c = a * b ; odd = True if (c%2) == 1 else False
- d = int(math.floor(math.sqrt(c))) ; e = c - (d**2) ; f = e - ((2 * d) + 1)
- n = i - d ; x = d - a
- # Bitmap Coloring
- base = (a + b) / a
- primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149]
- # TheEnd entry adding
- if e not in theend.keys(): theend[e] = {}
- if n not in theend[e].keys():
- theend[e][n] = []
- pixels[e,n] = (255,255,255)
- if f not in theend.keys(): theend[f] = {}
- if n-1 not in theend[f].keys(): theend[f][n-1] = []
- # CSV entry adding
- theend[e][n].append("{"+str(e)+":"+str(n)+":"+str(d)+":"+str(x)+":"+str(a)+":"+str(b)+"}")
- theend[f][n-1].append("{"+str(f)+":"+str(n-1)+":"+str(d+1)+":"+str(x+1)+":"+str(a,)+":"+str(b)+"}")
- img.show()
- img.save(path+"output.bmp")
- def outputTheEnd(path, theend, i_max=256, x_min=-64, y_min=0, set_size=12, x_max=64, y_max=64):
- f = open(path+"output.csv", 'w')
- for y in range(y_min, y_max):
- for z in range(0, set_size):
- for x in range(x_min, x_max):
- if (x in theend.keys()) and (y in theend[x].keys()) and len(theend[x][y]) > z:
- f.write(theend[x][y][z]+",")
- else:
- f.write("{},")
- f.write('\n')
- f.close()
- if __name__ == '__main__':
- theend = {}
- # To change accordingly to he folder where you want to save stuff
- path = "~/"
- createTheEnd(path, theend)
- outputTheEnd(path, theend)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement