[ Launch: Helping Dave - new ] 8035870 by Radcliffe
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
| #!/usr/bin/env/python | |
| # Author: David Radcliffe ([email protected]) | |
| # Date: 20 December 2013 | |
| # This code is in the public domain. | |
| # Problem: Given a square 5x5 grid of points, find five circles that together pass through all 25 points. | |
| # There are 21 essentially different solutions. Two solutions are considered the same if they differ only | |
| # by a rotation or reflection. This script finds all of these solutions. | |
| # The solutions are rendered graphically at http://www.gotmath.com/doc/fivecircles.html |
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
| # Solution to a problem posted by Deomani Sharma Ramsurrun | |
| # David Radcliffe 11 Dec 2013 | |
| # This code is in the public domain | |
| ########################################################### | |
| import fractions | |
| # Generate all non-negative integer solutions to the system | |
| # ab + ac + ad = 6 | |
| # ab + bc + bd = 9 |
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
| # Python 2.7 program to check whether two integer powers are equal, | |
| # WITHOUT computing the powers. | |
| # | |
| # Author: David Radcliffe, 1 December 2013. | |
| ALLOW_ZERO_TO_ZERO = True | |
| # If True, assume that 0 to the 0 is 1. | |
| # If False, assume that 0 to the 0 is undefined. | |
| # Return the sign of a^b. There are four possible results |
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
| #!/usr/bin/python | |
| # 5-line fuzzer below is from Charlie Miller's | |
| # "Babysitting an Army of Monkeys" | |
| from os import listdir | |
| from os.path import isfile, join | |
| mypath = '/users/david/documents/python/pdf/' | |
| file_list = [ mypath+f for f in listdir(mypath) if isfile(join(mypath,f)) ] |
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 collections import Counter | |
| def sanity_check(grid): | |
| if not(isinstance(grid,list) | |
| and len(grid) == 9 | |
| and all(isinstance(row, list) | |
| and len(row) == 9 | |
| for row in grid) | |
| and all(isinstance(elt, int) | |
| and 0 <= elt <= 9 |
NewerOlder