Yep, I have a Math Degree now
Surprisingly, no one has posted this one yet:
There are 10 kinds of people in the world. Those who understand binary and those who don't.
Also, congratulations on your degree(s). I remember my B.S. years to be very hectic. Glad when they were over. It sounds like you're planning to go on to graduate school. YOu have to work your butt off there, too, but it's a much different atmosphere than under-graduate. You'll like it.
There are 10 kinds of people in the world. Those who understand binary and those who don't.
Also, congratulations on your degree(s). I remember my B.S. years to be very hectic. Glad when they were over. It sounds like you're planning to go on to graduate school. YOu have to work your butt off there, too, but it's a much different atmosphere than under-graduate. You'll like it.
Can you prove yourself?litlkeck wrote:I've mentioned it before, and I don't know how many of you recall or saw it then, but I'm finishing my Senior year at the University of Dayton where I have been working on two degrees. Well, I got my exam scores back for my final Math class, Real Analysis, and I have in fact passed, don't worry I wasn't close to failing. But, at least now it's official. I have a bachelor of science in Mathematics. Now, my last semester, I'll be finishing up my Computer Science degree, two classes left, and a couple of other side classes I need for that major. So, in four short years I'll have earned two degrees, and it's been a rough go but worth it. Thought I'd share my joy with you all on finishing one degree.
~Keck
Solve those problems:
1) a = 1 + 1
2) What is the sum of all numbers from 1 to 1000000000
3) How do you solve problem 2 in 10 seconds?
Thus spake Zarathustra
a) 2
b) Now, if you're asking this from a purely Mathematical perspective, your answer is surely infinity - as between any two rational numbers, i.e. 1 and 1000000000 there are an infinite number of numbers. So, even if you were to ask me to sum up all the numbers from 1 to 2, my answer would be the same. Now, if you clarified that you wanted those to be the natural numbers from 1 to 1000000000, i.e. the counting numbers (1, 2, 3, ...), then I would tell you that the answer is this: 500000000500000000
c) for c, I would use ML, since anyone could download sml and check the answer out. Code and result follows:
- fun sum(x,y) = if x = y then x else x + sum(x+1, y);
val sum = fn : int * int -> int
- sum(1, 1000000000);
val it = 500000000500000000: int
Lines with - in front of it were input I gave, i.e. first the function then the values to the function. The other lines are the result of what I gave it. The second line, if you notice, breaks down what the function can take even though I never gave x and y types. This is because ML is strongly typed and forces you to stick to one type, and int was selected because in my recursive calls I added 1 to x, i.e. if x were a real number I should have added 1.0 otherwise it thinks I'm adding integers. The 4th line is jus the result. NOTE: I cheated somewhat to get this result, as that number will cause a core dump on any system because it is too large to normally handle. I did some boring behind the scences work to ensure I could calculate a number that big.
There, have I proved my nerdery?
~Keck
b) Now, if you're asking this from a purely Mathematical perspective, your answer is surely infinity - as between any two rational numbers, i.e. 1 and 1000000000 there are an infinite number of numbers. So, even if you were to ask me to sum up all the numbers from 1 to 2, my answer would be the same. Now, if you clarified that you wanted those to be the natural numbers from 1 to 1000000000, i.e. the counting numbers (1, 2, 3, ...), then I would tell you that the answer is this: 500000000500000000
c) for c, I would use ML, since anyone could download sml and check the answer out. Code and result follows:
- fun sum(x,y) = if x = y then x else x + sum(x+1, y);
val sum = fn : int * int -> int
- sum(1, 1000000000);
val it = 500000000500000000: int
Lines with - in front of it were input I gave, i.e. first the function then the values to the function. The other lines are the result of what I gave it. The second line, if you notice, breaks down what the function can take even though I never gave x and y types. This is because ML is strongly typed and forces you to stick to one type, and int was selected because in my recursive calls I added 1 to x, i.e. if x were a real number I should have added 1.0 otherwise it thinks I'm adding integers. The 4th line is jus the result. NOTE: I cheated somewhat to get this result, as that number will cause a core dump on any system because it is too large to normally handle. I did some boring behind the scences work to ensure I could calculate a number that big.
There, have I proved my nerdery?
~Keck
Assuming we are summing over integers and the probem is in base 10, a quick and easy way to sum all the integers between 1 and 1000000000 is to use the fact that the
sum over k for k = 1 to N is N^2/2 + N/2.
In this case, N is 10^9, so the sum is 10^18/2 + 10^9/2 = 5E17 + 5E8 = 500000000500000000. No programming necessary. Same as litlkeck's result.
I had to derive this formula a long time ago.
sum over k for k = 1 to N is N^2/2 + N/2.
In this case, N is 10^9, so the sum is 10^18/2 + 10^9/2 = 5E17 + 5E8 = 500000000500000000. No programming necessary. Same as litlkeck's result.
I had to derive this formula a long time ago.
Hey litlkeck,
Playing around with 1 to 1000 and 1 to 100 is impressive.
I used much smaller numbers like 1 to 4 and 1 to 5. I observed this pattern:
*
**
***
****
has about half the number of dots compared to
****
****
****
****
which we know has N x N dots (in this case, 4 x 4 dots)
So I was sure the answer was related to N^2/2. The difference was half the number along the diagonal (N/2), hence, N^/2 + N/2.
Playing around with 1 to 1000 and 1 to 100 is impressive.
I used much smaller numbers like 1 to 4 and 1 to 5. I observed this pattern:
*
**
***
****
has about half the number of dots compared to
****
****
****
****
which we know has N x N dots (in this case, 4 x 4 dots)
So I was sure the answer was related to N^2/2. The difference was half the number along the diagonal (N/2), hence, N^/2 + N/2.
my summing abilities comes from working with series a whole lot and doing lots of cross-sums. What I did was notice that 1 to 100 is: 5050
And 1 to 1000 is: 500500
And, of course 1 to ten is 55
So, each factor of 10 bigger, you add a zero after each 5, meaning the number of digits in the answer was twice that of the value you were summing. So, it wasn't hard to see how I got 1 to 1000000000. Your way is more clever, and as practiced linear algebraist, I admonish myself for not trying a similar approach.
~Keck
And 1 to 1000 is: 500500
And, of course 1 to ten is 55
So, each factor of 10 bigger, you add a zero after each 5, meaning the number of digits in the answer was twice that of the value you were summing. So, it wasn't hard to see how I got 1 to 1000000000. Your way is more clever, and as practiced linear algebraist, I admonish myself for not trying a similar approach.
~Keck