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
## The problem could be written as u + 13v/w + x + 12y - z - 11 + pq/r -10 = 66 | |
## which reduces to u + 13v/w + x + 12y - z + pq/r = 87 | |
## This problem was solved on [1] "Wed May 27 17:46:52 2015" | |
baoloc <- function() | |
{ | |
packages <- rownames(installed.packages()) | |
if("combinat" %in% packages) library("combinat") else install.packages("combinat") | |
numbers <- 1:9 | |
permutations <- permn(numbers) ## list of all permutations of vector input |
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
[1] "The number of solutions are:" | |
[1] 128 | |
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] | |
solution 9 1 2 5 6 7 3 4 8 | |
solution 7 9 6 1 5 2 3 4 8 | |
solution 1 9 6 7 5 2 3 4 8 | |
solution 1 5 2 3 4 8 7 9 6 | |
solution 1 5 2 3 4 8 9 7 6 | |
solution 5 1 2 9 6 7 3 4 8 | |
solution 5 1 2 9 6 7 4 3 8 |
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
# set working directory to local directory where the data is kept | |
setwd("~/IGIDR/Development Economics - MIT/Homework Assignment 01") | |
# read the data | |
wb_dev_ind = read.csv("wb_dev_ind.csv") | |
# summarize data | |
summary(wb_dev_ind) | |
# Question 1 | |
# What is the Mean of GDP per capita? What is the standard deviation of GDP per capita? |
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
# Set working directory to local directory where the data is kept | |
setwd("~/IGIDR/Development Economics - MIT/Homework Assignment 02") | |
# read data | |
migueldata = read.csv("ted_miguel_worms.csv", header = TRUE) | |
attach(migueldata) | |
# Question 6 | |
# How many observations are there per pupil? (Enter a whole number of 0 or higher)? | |
length(migueldata$pupid) | |
length(unique(migueldata$pupid)) | |
# Question 7 |
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
def karatsuba(x,y): | |
"""Function to multiply 2 numbers in a more efficient manner than the grade school algorithm""" | |
if len(str(x)) == 1 or len(str(y)) == 1: | |
return x*y | |
else: | |
n = max(len(str(x)),len(str(y))) | |
nby2 = n / 2 | |
a = x / 10**(nby2) | |
b = x % 10**(nby2) |
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
procedure karatsuba(num1, num2) | |
if (num1 < 10) or (num2 < 10) | |
return num1*num2 | |
/* calculates the size of the numbers */ | |
m = max(size_base10(num1), size_base10(num2)) | |
m2 = m/2 | |
/* split the digit sequences about the middle */ | |
high1, low1 = split_at(num1, m2) | |
high2, low2 = split_at(num2, m2) | |
/* 3 calls made to numbers approximately half the size */ |
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 string import * | |
# create decipher dictionary | |
l = letters[:26] | |
decipher = "".join([l[(i+3)%26] for i in range(len(l))]) | |
decipher = dict(zip(decipher,l)) | |
# open and read encrypted text | |
filename = 'estherDuflo.txt' | |
f = open(filename, 'rw') |
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
5U LL*?} @?_ w@MLh @h!i| L?ti^ i?Uit Lu 5U LL* | |
L?t|h U|L? ? W?_L?it@G ,_i?Ui uhL4 @? N? t @* L*U) | |
, Tih4i?| | |
,t| ih # L | |
W | |
Devwudfw | |
Ehwzhhq 4<:6 dqg 4<:;/ wkh Lqgrqhvldq Jryhuqphqw frqvwuxfwhg ryhu 94/333 sulpdu| | |
vfkrrov wkurxjkrxw wkh frxqwu|1 Wklv lv rqh ri wkh odujhvw vfkrro frqvwuxfwlrq surjudpv rq | |
uhfrug1 L hydoxdwh wkh hhfw ri wklv surjudp rq hgxfdwlrq dqg zdjhv e| frpelqlqj glhuhqfhv | |
dfurvv uhjlrqv lq wkh qxpehu ri vfkrrov frqvwuxfwhg zlwk glhuhqfhv dfurvv frkruwv lqgxfhg |
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
5r ii*?} @?_ t@jie @e!f| i?qf^ f?rfq ir 5r ii* | |
i?q|e r|i? ? t?_i?fq@d ,_f?rf rei4 @? k? q @* i*r) | |
, qfe4f?| | |
,q| fe # i | |
t | |
abstract | |
between 4<:6 and 4<:;/ the indonesian government constructed over 94/333 primar| | |
schools throughout the countr|1 this is one of the largest school construction programs on | |
record1 i evaluate the eect of this program on education and wages b| combining dierences | |
across regions in the number of schools constructed with dierences across cohorts induced |
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
# Code for the merge subroutine | |
def merge(a,b): | |
""" Function to merge two arrays """ | |
c = [] | |
while len(a) != 0 and len(b) != 0: | |
if a[0] < b[0]: | |
c.append(a[0]) | |
a.remove(a[0]) | |
else: |