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
# This Python script generates a directed graph with | |
# vertex set V = {0, 1, 2, ..., m-1} and edge set | |
# E = {(n, f(n)) : n in V} where f(n) = n*n + c (mod m). | |
# | |
# Requires the python-igraph package (http://igraph.org/python/) | |
# | |
# Author: David Radcliffe (14 February 2014) | |
# Based on an idea of James Tanton | |
# https://twitter.com/jamestanton/status/549558473868849152 | |
# |
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 script to list the titles and running times of the videos | |
# in a YouTube playlist. | |
# Note: Only works for up to 100 videos. TODO: Fix this bug. | |
# The playlist id can be found in the playlist's URL. | |
playlist_id = "PLt5AfwLFPxWLNZRKWlcRmTABh_SExiiCj" | |
from lxml import html | |
import requests |
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
ZIP Code,County | |
55001,Washington County | |
55003,Washington County | |
55005,Anoka County | |
55010,Dakota County | |
55011,Anoka County | |
55014,Anoka County | |
55016,Washington County | |
55020,Scott County | |
55024,Dakota County |
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 math import log, sqrt, pi, e | |
from scipy.special import lambertw | |
fomm numpy import real | |
# http://mathforum.org/kb/message.jspa?messageID=342551&tstart=0 | |
def invfactorial(n): | |
""" Approximate inverse factorial""" | |
L = log((x + .036534) / sqrt(2*pi)) | |
return real(L/W(L/e) - .5) | |
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
""" | |
Problem: | |
Arrange the numbers from 1 to m*n in an m-by-n grid so that | |
no two consecutive numbers are placed in adjacent cells. | |
In how many ways can this be done? Two squares are considered | |
touching if they share a corner. | |
Example: |
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
""" | |
James Tanton @jamestanton asked: | |
Is there a power of three whose digits can be rearranged to form | |
another power of three? | |
(https://twitter.com/jamestanton/status/676773021223272448) | |
The following Python script searches for examples. There is no power | |
of three, less than 3^200000, whose digits can be rearranged to form | |
another power of three. | |
""" |
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
""" | |
Euler's four square theorem states that | |
(x1^2 + x2^2 + x3^2 + x4^2) * | |
(y1^2 + y2^2 + y3^2 + y4^2) = | |
z1^2 + z2^2 + z3^2 + z4^2, | |
where | |
z1 = x1*y1 + x2*y2 + x3*y3 + x4*y4 | |
z2 = x1*y2 - x2*y1 - x3*y4 + x4*y3 |
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
library(dplyr) | |
d <- read.csv('expenditures.csv') | |
cats <- unique(d$ProgramCategory) | |
newnames <- gsub("[- ]", "", cats) | |
e <- d %>% | |
filter(ProgramCategory == cats[1]) %>% | |
select(Year:StudentsServed) |
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
Location | DateClosedToPublic | StoreNumber | StoreType | lon | lat | |
---|---|---|---|---|---|---|
14331 Count Rd. 99, Headland, AL | 2016-01-28 | 2173 | Walmart Express | -85.3259952 | 31.3607946 | |
18 Apple Way, Ashford, AL | 2016-01-28 | 2011 | Walmart Express | -85.237821 | 31.1765287 | |
952 E. Lawrence Harris Hwy, Slocomb, AL | 2016-01-28 | 2165 | Walmart Express | -85.5907905 | 31.1076635 | |
407 West Washington St., Abbeville, AL | 2016-01-28 | 2186 | Walmart Express | -85.2594391 | 31.5737215 | |
6361 Hwy 72 East Gurley, AL | 2016-01-28 | 2235 | Walmart Express | -86.3700933 | 34.6947341 | |
87395 US Hwy 278, Snead, AL | 2016-01-28 | 2260 | Walmart Express | -86.3915109 | 34.1173155 | |
3530 Cathedral Caverns Hwy, Grant, AL | 2016-01-28 | 3769 | Walmart Express | -86.2611173 | 34.5014024 | |
10188 Hwy 431 South, New Hope, AL | 2016-01-28 | 3779 | Walmart Express | -86.4308169 | 34.5482599 | |
720 N Hwy 71, Mansfield, AR | 2016-01-28 | 2498 | Walmart Express | -94.2619279 | 35.077937 |
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
""" | |
Problem M379, Crux Mathematicorum | |
Proposed by John Grant McLoughlin, University of New Brunswkci, | |
Fredericton, NB. | |
The integers 27+C, 555+C, and 1371+C are all perfect squares, the square | |
roots of which form an arithmetic sequence. Determine all possible values | |
of C. | |
""" |