Skip to content

Instantly share code, notes, and snippets.

@JuhaS
Created February 10, 2012 21:43
Show Gist options
  • Save JuhaS/1793164 to your computer and use it in GitHub Desktop.
Save JuhaS/1793164 to your computer and use it in GitHub Desktop.
Challenge
===================
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