Exemplo n.º 1
0
def p35():
	bad_primes = []
	
	circular_primes = []
	x = sieve(1000000)
	
	even = ['2', '4', '6', '8', '0']
	for i in range(0, len(x)):
		counter = 0
		if set(str(x[i])).intersection(set(even)):
			continue
		elif x[i] in bad_primes:
			continue
		elif x[i] in circular_primes:
			continue
		else:
			s = getRotations(x[i])	
			
			for j in s:
				if j in x:
					counter += 1
			if counter == len(s):
				circular_primes = circular_primes + s
			else:
				bad_primes = bad_primes + s

		
	return list(set(circular_primes))
Exemplo n.º 2
0
def p27():
	x = sieve()
	y = deepcopy(x)	
	for j in range(0, len(x)):
		x.insert(0, -1*y[j])
	print x
	maxnumofprimes = 0
	coefficients = (0,0)
	prod = 1
	for i in range(0, len(x)):
		for j in range(0, len(x)):
			t = 0
			while (t**2 + x[i]*t + x[j]) in x:
				t+=1
			if t > maxnumofprimes:
				maxnumofprimes = t
				prod = x[i]*x[j]
				coefficients = x[i], x[j]
	return coefficients
Exemplo n.º 3
0
from sieveoferatosthenes import sieve
peer = []
siv = sieve(10000)
for x in siv:
    if x>10:
        for p in range(1,len(str(x))-1):
            
            if int(str(x)[p:]) in siv:
                continue
                
            else:
                break
            print("yeah")
            
            
            
print(peer)

if __name__ == '__main__':
    pass
Exemplo n.º 4
0
from sieveoferatosthenes import sieve
import itertools
siv = sieve(1000)
totestsiv = sieve(10000)
neg = list(map(lambda n: n*-1,siv))
siv.extend(neg)



def function(a,b,n):
    return n**2 + a*n + b

highest = ("","",0)
print("begin")
for x in siv:
    
    
    for p in range(-998,1000):
        
        for each in range(80):
        
            if function(p,x,each) in totestsiv:
                continue
                
            else:
                if highest[2] < each:
                    highest = (x,p,each)
                    
                break
    
print(highest)
Exemplo n.º 5
0
from sieveoferatosthenes import sieve
def longdivision(denominator):
    remaindertable = []
    numer = 1.0
    denom = denominator
    total=0
    while True:
        while numer < denom:
            numer *= 10
        numer = numer%denom
        if numer == 0:
            return 0
        if numer not in remaindertable:
            remaindertable.append(numer)
            total+=1
        else:
            break
    return total

highest = 0
number = 0
table = {}

for x in sieve(1000):
    if longdivision(x)>highest:
        highest = longdivision(x)
        number = x

    
print(number)