This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def goldbachs(number): | |
for x in range(1, int(math.sqrt(number))+1): | |
temp_var = number - 2*(x**2) | |
if is_prime(temp_var) == True: | |
return True | |
return False | |
def compute(): | |
count = 33 | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def all_numbers(alist): | |
nums = set() | |
for x in alist: | |
for y in x: | |
nums.add(y) | |
return list(nums) | |
def method1(): | |
possible_numbers = (all_numbers(keys)) | |
possible_passcode = list(itertools.permutations(possible_numbers)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_pentagonal(x): | |
#Take the inverse function to test whether or not a number is pentagonal | |
if (1+(24*x+1)**0.5) % 6 == 0: | |
return True | |
return False | |
def is_hexagonal(x): | |
#Take the inverse function to test whether or not a number is hexagonal | |
if (1+(8*x+1)**0.5) % 4 == 0: | |
return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_pentagonal(x): | |
#Take the inverse function to test whether or not a number is pentagonal | |
if (1+(24*x+1)**0.5) % 6 == 0: | |
return True | |
return False | |
def compute(): | |
k = 1 | |
while True: | |
for j in range(1,k): # this ensures that a > b therefore a-b is minimised |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Triangle_number = [ "the triangle numbers from the txt file" ] | |
def sumofname(x): | |
namesum = 0 | |
for i in range(len(words[x])): | |
namesum += ord(words[x][i])-64 | |
return namesum | |
def compute(): | |
count = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute(): | |
checker = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] | |
concatenated_product_list = [] | |
for z in range(2,10): | |
for x in range(1,10**math.floor(9/z)): | |
temp_str = "" | |
for y in range(1,z+1): | |
product = x*y | |
temp_str += str(product) | |
if sorted(temp_str) == checker: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum_digits_mod(x): | |
facts = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880] | |
totalsum = 0 | |
while x != 0: | |
totalsum += facts[x % 10] | |
x = x // 10 | |
return totalsum | |
def compute(): | |
overalltotal = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute(): | |
values = [] | |
numer = 1 | |
denom = 1 | |
for x in range(10,100): | |
for y in range(x+1, 100): | |
if x%10 != 0 and y%10 != 0: | |
value1 = str(x) | |
value2 = str(y) | |
for a in value1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute(): | |
testlist = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] | |
values = set() | |
for x in range(9,99): | |
for y in range(99,999): | |
answer = x*y | |
if answer < 10000: | |
testingvalue = sorted(str(x) + str(y) + str(answer)) | |
if testingvalue == testlist: | |
values.add(answer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute(): | |
totalways = 1 | |
for a in range(0,3): | |
for b in range(0,(2-a)*2 + 1): | |
for c in range(0,math.ceil((2-a-b*0.5)*10)+1): | |
for d in range(0,math.ceil((2-a-b*0.5-c*0.2)*20)+1): | |
for e in range(0,math.ceil((2-a-b*0.5-c*0.2-d*0.1)*40)+1): | |
for f in range(0,math.ceil((2-a-b*0.5-c*0.2-d*0.1-e*0.05)*100)+1): | |
for g in range(0,math.ceil((2-a-b*0.5-c*0.2-d*0.1-e*0.05-f*0.02)*200)+1): | |
if a*100 + b*50 + c*20 + d*10 + e*5 + f*2 + g*1 == 200: |