Fermat 25 Output

265 days ago by b0yscout

num = 25 ind_count =[25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1] count = 0 fermat = (2^(2^num))+1 #################################################################### # Note - These files are LARGE: EACH FILE is 10,000,000 chars # #################################################################### # From right to left, hack off 10m digit parts of the number, and # save them to files in decreasing order. Python # doesn't use element 25, because it counts from the 0th element, so # the intermediate files start at 24, and # decrease by one from right to left. ######## Output is RULE BASED - see end after "done." ############# # Hack off LAST 10m n = fermat%10^10000000 fermat = fermat - n fermat = fermat / 10^10000000 o = open('f_dat_end','w') o.write(str(n)) o.close() # Hack off 10m digits at a time, from Right to Left and # creatively name data files in descending order # until less than 10m digits remain for initial portion. while (fermat > 10^10000000): n=fermat%10^10000000 count = count + 1 n_count = ind_count[count] chomp = str(n_count) nomdeplume = ('f_dat' + chomp) o = open(nomdeplume,'w') o.write(str(n)) o.close() fermat = fermat - n fermat = fermat / 10^10000000 # put the final(LEFTMOST) digits in a "first part" file. o = open ('first_part', 'w') o.write(str(fermat)) o.close() print print "done" # To concatenate, use datafiles increasing/ascending Left to Right, starting with "first_part," # then f_dat low to f_dat high, and ending with "f_dat_end." 
       
done
done