def check_circle(nToCheck): bToReturn = True nRotating = rotate(nToCheck[-1]) while bToReturn and nRotating != nToCheck[-1]: if len(pfp.pfp(nRotating)) > 2: bToReturn = False nRotating = rotate(nRotating) return bToReturn
if (anToReturn[-1][0] == anPrimeFactors[0]): anToReturn[-1][1] += 1 else: anToReturn.append([anPrimeFactors[0],1]) anPrimeFactors.remove(anPrimeFactors[0]) return anToReturn nOn = 4 aanFactors = [[[2,1]],[[3,1]],[[2,2]],[[5,1]]] nFactors = 4 #looking for example def check(aanFactors): bToReturn = True for anFact in aanFactors: if len(anFact) != nFactors: bToReturn = False if bToReturn : bToReturn = my_distinct(aanFactors) return bToReturn while not check(aanFactors): #len(aanFactors[0]) != nFactors or len(aanFactors[1]) != nFactors or \ # len(aanFactors[2]) != nFactors or len(aanFactors[3]) != nFactors or not my_distinct(aanFactors): nOn += 1 aanFactors = aanFactors[1:] aanFactors.append(convert(pfp.pfp(nOn))) #print(aanFactors) #if nOn > 7000: # break print(nOn)
#print(pfp.pfp(79)) #n^2 + an + b where |a| <1000 and |b| < 1000 #if b is even, fail, n=2 even b div by 2, #also true of a, nMax = 0 nA = 1 nB = 41 for a in range(-999,999,2): for b in range(-999,999,2): if a%3 ==0 and b %3 == 0: continue nConsPrime =0 for i in range(0,1000): nTest = abs(i*i + a*i + b) anPFs = pfp.pfp(nTest) if len(anPFs) >2: break nConsPrime += 1 if nConsPrime > nMax: print(a,b, nConsPrime) nMax = nConsPrime nA = a nB = b # if b > -975: # break # if a > -975: # break print(nA, nB, nMax)
import pfp def rotate(nToRotate): nLen = 10 while nToRotate / nLen: nLen *= 10 return nToRotate / 10 + (nToRotate % 10) * nLen / 10 def check_circle(nToCheck): bToReturn = True nRotating = rotate(nToCheck[-1]) while bToReturn and nRotating != nToCheck[-1]: if len(pfp.pfp(nRotating)) > 2: bToReturn = False nRotating = rotate(nRotating) return bToReturn # print(pfp.pfp(34234)) nCount = 1 # starting with 2, even special case. for nToCheck in range(2, 1000000): # 1000000): anFactors = pfp.pfp(nToCheck) if len(anFactors) == 2: if check_circle(anFactors): print(nToCheck) nCount += 1 nToCheck += 1 print(nCount)