Skip to content

Instantly share code, notes, and snippets.

View phillipkent's full-sized avatar

Phillip Kent phillipkent

View GitHub Profile
@phillipkent
phillipkent / greedy-egyptian-fractions.py
Created March 29, 2013 11:17
Greedy algorithm for Egyptian fractions
# Greedy Algorithm for Egyptian Fractions
# To express a / b as a sum of unit fractions (1 / c_1) + ... + (1 / c_n)
def main():
print("*** Greedy algorithm for Egyptian fractions ***\n")
while 1:
try:
a = int(input("Enter a: "))
b = int(input("Enter b: "))
result = iterate(a,b)
@phillipkent
phillipkent / TrigMountains.pde
Created March 27, 2013 14:16
Design Science - Programs in Processing - Using randomness to create visual richness
/* TrigMountains
Version: 1.0, 2012-10-26
By Phillip Kent
http://www.phillipkent.net
Illustrates the use of randomness to generate visual richness.
In each drawing cycle, a sine-shaped solid is plotted, with random magnitude, period
and colour.
*/
@phillipkent
phillipkent / hextiling
Created March 22, 2013 15:54
Design Science - Programs in Processing - program for pattern generation using hexagonal tiling
/* hextiling
Hexagonal tiling
Version: 1.3 DEVELOPMENT, 2013-03-22
By Phillip Kent
Based on litmus2_hextiling prepared for the Cheltenham Science Festival 2013
[http://design-science.org.uk/litmus-paper/]
Acknowledgements: