Its over - the practical exams are finished. So here is the update:
4th of Feb:
I entered the examination hall trying to figure out possible worst case scenarios ( my experience with the highly inaccurate fractional weights during the physical balance experiment hasn’t been pleasant. ). I was shivering and I got experiment 10 - simple pendulum. I zoomed away and after 7 readings, submitted my paper. I am not going to write about that, doesn’t deserve space on this blog.
5th of Feb (i.e. today):
I entered the hall with an air of confidence around me. Well, it is the last time I do practicals in school so the nostalgia did bug me. I finished my salt analysis experiment in a jiffy. My salt was barium chloride and the yellow precipitate that is obtained when the salt solution is allowed to react with potassium chromate was striking. Anyway, I did my volumetric analysis experiment after that and I was asked to estimate the amount of oxalic acid in 1000 ml solution using a 0.02 M solution of KMnO4 (potassium permanganate). I got the result to be 6.3636 gram. Brilliant, its over !
Now, I solved a few sums in math over the past few days. Here are the hopefully ok solutions. The star highlight is the last problem. I found it on a newsgroup and considering someone mentioned Donald Knuth there, I was eager to see if I could solve “any” sum of this legend of a computer scientist. I need laminated pics of Knuth, Shannon and Dijkstra. Can someone point me to a source where I can find a framed pic of these pioneers ? Right, lets move to the math.
Question1:
Find the sum of the digits in 100! (100 factorial).
#!/usr/bin/python
#Author: Shriphani Palakodety
# ProjectEuler.net problem 20
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
def sumOfDigits(n):
num = factorial(n)
num_list = [ int(x) for x in str(num) ]
return sum(num_list)
print sumOfDigits(100)
Divide the numbers 1 ** 2, 2**2 …… 50 ** 2 into 2 groups so that the difference between the sums of the elements of each group is either 0 or the minimum value possible.
#!/usr/bin/python #Author: Shriphani Palakodety #Donald Knuth's problem (i think) def genNumList(n): num_list = [] for i in range(0, n+1): num_list.append( i ** 2) return num_list def pairMaker(num_list): list1 = num_list list2 = [] for i in range(0, len(list1)-1): list2.append(list1[i]) difference = abs(sum(list2) - sum(list1[i:])) yield (list1[i:], list2[:i], difference) def commode(n): bullshit = [ x for x in pairMaker(genNumList(n)) ] diff_list = [] for element in bullshit: diff_list.append(element[2]) return (diff_list, bullshit) def solution(n): i = commode(n)[0].index(min(commode(n)[0])) return commode(n)[1][i] print solution(50)
I found some more semantic filesystems material that I will read tomorrow. I’ve got 2 more euler problems which I am about to finish. Lots of work to do but there are only 24 hours in a day.



0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment