Skip to content

Instantly share code, notes, and snippets.

View MaxDonchenko's full-sized avatar
:octocat:

Max Donchenko MaxDonchenko

:octocat:
View GitHub Profile
Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states:
Every even integer greater than 2 can be expressed as the sum of two primes.
For example:
`6 = 3 + 3`</br>
`8 = 3 + 5`</br>
`10 = 3 + 7 = 5 + 5`</br>
`12 = 5 + 7`
def get_col_name(col):
abc = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"
col_name = ""
while col > 0:
letter_index = col % 26
if letter_index == 0:
letter_index = 26
col -= 26
col //= 26
col_name = abc[letter_index] + col_name
@MaxDonchenko
MaxDonchenko / lab3_var3_maxflow.py
Created January 24, 2016 21:00
Non-elegant calculating the maximal flow.
class Vertex:
def __init__(self, name, value=1, connections={}):
self.name = name
self.value = value
self.connections = connections
def __repr__(self):
return "%s(%d)" % (self.name, self.value)
graph = {'A': set(['B', 'C']),
'B': set(['A', 'D', 'E']),
'C': set(['A', 'F']),
'D': set(['B']),
'E': set(['B', 'F']),
'F': set(['C', 'E'])}
def dfs_paths(graph, start, goal):
stack = [(start, [start])]
while stack: