Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
CC=gcc | |
CFLAGS=-c -Wall -fPIC | |
SOURCES=calc_mean.c | |
OBJECTS=$(SOURCES:.c=.o) | |
.c.o: | |
$(CC) $(CFLAGS) $< -o $@ | |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
# We work out the Kaprekar's constant | |
function breakdown(x::Int) | |
y=[j for j in "$x"] | |
end | |
function put_together(y::Vector{Char}) | |
sum(parse(Int,y[i])*10^(i-1) for i=1:length(y)) | |
end | |
""" |
This file contains 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
parksim <-function(nreps) { | |
nvals<-rgeom(nreps,0.15)+1 | |
dvals<-ifelse(nvals<=10,11-nvals,nvals-11) | |
mean(dvals) | |
} | |
system.time(parksim(100000000)) |
This file contains 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
import random | |
def pm(x): | |
if x>0: | |
return "+" | |
else: | |
return "" | |
def int_prob_gen(n): | |
s=0 |
This file contains 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
function int_prob_gen(n) | |
starting_time=time() | |
s=0 #successes | |
pm(x)=x>0? "+":"" | |
for i=1:n | |
x=rand(-10:10) | |
y=rand(-10:10) | |
op=rand(["+","-"]) | |
right_ans="($x)$op($y)"|>parse|>eval | |
parse_correct=false |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.