import orbitsByPeriodRotNum as orbitGetter import orbitSetGenSlow2 as orbitSetGen import portraitGen sigma = int(input("Sigma: ")) rotNumer = int(input("Numer: ")) rotDenom = int(input("Denom: ")) while True: print() print(sigma) print orbits = orbitGetter.getOrbits(sigma, rotNumer, rotDenom) layerNums = [] layerCount = [] for orbit in orbits: print(orbit + " : " + str(len(orbitSetGen.genOrbitSet(orbit, sigma, 2)))) if len(orbitSetGen.genOrbitSet(orbit, sigma, 2)) in layerNums: layerCount[layerNums.index( len(orbitSetGen.genOrbitSet(orbit, sigma, 2)))] += 1 else:
from xlutils.copy import copy rb = open_workbook("blankForPython.xls") wb = copy(rb) s = wb.get_sheet(0) cellY = 0 cellX = 0 sigma = int(input("Sigma: ")) numer = int(input("Rot Num Numerator: ")) denom = int(input("Rot Num Denominator: ")) orbits = orbitGetter.getOrbits(sigma, numer, denom) data = {} for orbit in orbits: portrait = portraitGen.genPortrait(orbit, sigma) if portrait == "1122": print(orbit) if portrait in data: data[portrait].append(len(orbitSetGen.genOrbitSet(orbit, sigma, 2)))
else: rb = open_workbook('orbitSets.xls') wb = copy(rb) s = wb.get_sheet(0) cellY = 0 cellX = 0 sigma = 2 while True: curOrbits = orbits.getOrbits(sigma, 4, 7) for orbit in curOrbits: orbitSet = orbitSetGetter.getOrbitSet(orbit, sigma) complete = True for orbitInSet in orbitSet: beforeCopy = True for i in range(len(orbitSet) - 1): if orbitSet[i] == orbitInSet:
import orbitsByPeriodRotNum as orbitGetter import rotCheck import orbitGenFromPoint as orbitGen from fractions import Fraction inputNum = input("Orbit: ") sigma = int(input("Sigma: ")) rotNumer = rotCheck.checkRot(inputNum, sigma, True)[1] orbits = orbitGetter.getOrbits(sigma, rotNumer, len(inputNum)) """ orbit = [Fraction(int(inputNum, sigma), sigma**len(inputNum) - 1)] orbit.append((orbit[-1] * sigma) % 1) while orbit[0] != orbit[-1]: orbit.append((orbit[-1] * sigma) % 1) orbit.pop() """ orbit = orbitGen.genOrbit( Fraction(int(inputNum, sigma), sigma**len(inputNum) - 1), sigma) ordered = sorted(orbit) for i in orbits:
period = int(input("Period to start search: ")) #next excel cell to write on cellY = 0 cellX = period - 1 denom = (sigma**period) - 1 while True: numer = 1 while numer < (period / 2): if gcd.gcd(numer, period) == 1 or numer == 1: orbits = orbitGetter.getOrbits(sigma, numer, period) for i in range(len(orbits)): orbitSet = orbitSetGenSlow2.genOrbitSet(orbits[i], sigma) print(len(orbitSet), orbitSet) if len(orbitSet) == 1: s.write(cellY, cellX, orbitSet[0]) print(orbitSet[0]) cellY += 1 numer += 1
def genOrbitSet(inputNum, sigma=0, desiredLength=0): #print(inputNum) if sigma == 0: for i in range(len(inputNum)): if sigma < int(inputNum[i]): sigma = int(inputNum[i]) sigma += 1 rotNumer = rotCheck.checkRot(inputNum, sigma, True)[1] orbits = orbitGetter.getOrbits(sigma, rotNumer, len(inputNum)) orbit = orbitGen.genOrbit( Fraction(int(inputNum, sigma), sigma**len(inputNum) - 1), sigma) ordered = sorted(orbit) orbitSetApplicants = [inputNum] for i in orbits: orbitTest = [Fraction(int(i, sigma), sigma**len(i) - 1)] orbitTest.append((orbitTest[-1] * sigma) % 1) while orbitTest[0] != orbitTest[-1]: orbitTest.append((orbitTest[-1] * sigma) % 1) orbitTest.pop() orderedTest = sorted(orbitTest) if inSet(orderedTest, ordered): orbitSetApplicants.append(i) orbitSets = [[inputNum]] for i in range(len(orbitSetApplicants) - 1): tempOrbitSet = [inputNum, orbitSetApplicants[i + 1]] if desiredLength == 0 or desiredLength > 2: for j in range(len(orbitSetApplicants) - 2): partOfSet = True for k in range(len(tempOrbitSet)): if i > j: if not inSet(orbitSetApplicants[j + 1], tempOrbitSet[k], sigma): partOfSet = False else: if not inSet(orbitSetApplicants[j + 2], tempOrbitSet[k], sigma): partOfSet = False if partOfSet: if i > j: tempOrbitSet.append(orbitSetApplicants[j + 1]) else: tempOrbitSet.append(orbitSetApplicants[j + 2]) if len(tempOrbitSet) > len(orbitSets[0]) and desiredLength == 0: orbitSets = [tempOrbitSet] elif desiredLength != len( orbitSets[0]) and desiredLength == len(tempOrbitSet): orbitSets = [tempOrbitSet] elif len(tempOrbitSet) == len(orbitSets[0]): orbitSets.append(tempOrbitSet) return orbitSets