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
from primeModule import is_prime | |
biggest = 1 | |
n = lambda a,b,c: '9'*a + b + '9'*c | |
for j in range(1000): | |
for digit in '124578': | |
for i in range(2000): | |
number = int(n(i,digit,j)) | |
if is_prime(number): |
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
from heapq import nsmallest, nlargest | |
from itertools import product | |
def findSmallestStd(food, n): | |
food.sort(reverse=True) | |
while len(food) % n: | |
food.append(0) | |
family_count = len(food) // n |
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
STD for n = 2: 6.368013505010808 | |
[(999, 1), (998, 1), (998, 4), (998, 5), (997, 6), (997, 7), (997, 11), (996, 11), (995, 12), (995, 12), (993, 13), (993, 13), (992, 14), (991, 16), (988, 17), (988, 18), (988, 18), (988, 20), (987, 23), (986, 23), (986, 23), (985, 25), (985, 26), (984, 27), (984, 27), (983, 28), (983, 28), (983, 28), (982, 30), (980, 32), (978, 32), (976, 32), (976, 37), (976, 39), (975, 40), (972, 41), (972, 42), (970, 43), (966, 45), (966, 47), (965, 48), (965, 48), (964, 48), (964, 48), (963, 48), (963, 49), (961, 50), (960, 50), (960, 50), (960, 51), (960, 53), (958, 55), (958, 56), (956, 57), (955, 58), (954, 63), (953, 63), (952, 64), (951, 65), (950, 65), (949, 65), (949, 66), (949, 67), (949, 68), (947, 69), (946, 71), (944, 73), (941, 73), (941, 74), (940, 74), (939, 75), (938, 76), (937, 77), (937, 77), (934, 77), (933, 80), (932, 81), (932, 83), (932, 84), (931, 85), (930, 85), (929, 85), (929, 85), (928, 88), (927, 88), (927, 88), (926, 89), (926, 93), (925, 93), (925, 94), (925, |
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
global count | |
count = 0 | |
def f(depth, depth_left, axis_of_last_move, last_slice, slice1, slice2, slice3, slice4): | |
if depth_left == 0: | |
global count | |
count+=1 | |
else: | |
for axis in range(3): | |
if axis == axis_of_last_move: |
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
from scipy import spatial | |
import numpy as np | |
import time | |
def nearest_neighbour(points_a, points_b): | |
tree = spatial.cKDTree(points_b) | |
return tree.query(points_a)[1] | |
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
from hashlib import md5 | |
from time import time | |
def views_match(cube, top, front, side): | |
view_from_top = [int(sum(cube[i::16]) > 0) for i in range(16)] | |
view_from_front = [int(sum(cube[i+j:i+j+16:4]) > 0) for i in range(0, 64, 16) for j in range(4)] | |
view_from_side = [int(sum(cube[i+j:i+j+4]) > 0) for i in range(0, 64, 16) for j in reversed(range(0, 16, 4))] | |
return view_from_top == top and view_from_front == front and view_from_side == side |
This file has been truncated, but you can view the full file.
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
Seed: 000091, cubes: 13, cube: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0] | |
Seed: 000157, cubes: 12, cube: [1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0] | |
Seed: 000160, cubes: 13, cube: [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0] | |
Seed: 000262, cubes: 15, cube: [0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0] | |
Seed: 000449, cubes: 12, cube: [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, |
This file has been truncated, but you can view the full file.
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
Seed: 000091, blocks: 13, cube: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0] | |
Seed: 000157, blocks: 12, cube: [1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0] | |
Seed: 000160, blocks: 13, cube: [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0] | |
Seed: 000262, blocks: 15, cube: [0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0] | |
Seed: 000449, blocks: 12, cube: [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.RenderingHints; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.Timer; | |
import java.awt.event.*; | |
@SuppressWarnings("serial") | |
public class Game extends JPanel implements ActionListener, KeyListener { |
OlderNewer