Created
February 10, 2012 21:43
-
-
Save JuhaS/1793164 to your computer and use it in GitHub Desktop.
Challenge
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
=================== | |
Challenge 1: | |
- On python console | |
=================== | |
i = 0 | |
sum = 1 | |
i = 2 | |
s = 10 | |
while True: | |
sum *= i | |
i = i+1 | |
t = 0 | |
for j in range(len(str(sum))): | |
t += int(str(sum)[j]) | |
if t > 8000 : | |
print t | |
if t == 8001: | |
print "FOUND: " + str(i-1) + " | |
break | |
=================== | |
Challenge 2: | |
- On chrome console | |
=================== | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
---- | |
var sum = 0; | |
$.each($("p"),function(){ sum+=$(this).parents("*").not("body,html").size() }); | |
mean = sum/$("p").length | |
var dsum = 0; | |
$.each($("p"),function(){ dsum+=Math.pow(($(this).parents("*").not("body,html").size()-mean), 2) }); | |
sd = Math.sqrt(sum/$("p").length); | |
console.log(sd); | |
=================== | |
Challenge 3: | |
- On python console | |
=================== | |
sum = 1 | |
i = 900 | |
while i > 0: | |
sum += 900.0/i | |
i = i-1 | |
i=0 | |
tsum = 0 | |
while tsum/sum<0.5: | |
i = i+1 | |
tsum += 900.0/i | |
print "ANSWER: " + str(i) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment