The ellipses (...) are a (more or less) official notation for a continuation, so the sum of all even numbers starting at 2 and ending at 98 is written as:

2+4+6+ ... +(2*49).

The sum of the first 'n' numbers (this is the general case) is written as:

1+2+3+ ... +n.

Centuries (milleniums actually) ago it was discovered that this sum equals:

n*(n+1)/2

Try some small examples. So if the sum of the first 'n' numbers can be written as n*(n+1)/2 then twice this sum can be written as n*(n+1).

So, the sum of the first even numbers up to 98 is:

2+4+6+8+ ... +2*49 == 49*(49+1) == 49*50 == 2450.

Comprendo?

kind regards,

Jos

Why do you give an example of 1+2+3...? Why even bring it up?When you say.. "THIS SUM" what sum are you talking about. When you say first n numbers WHAT NUMBERS specifically? Twice the sum? Twice the sum of what?

I just think your wrong. I can not find anyway for it to print every number without ..."stupid loops"

Sure, you'll need a loop to print out every single number; you won't need any loops if you want to calculate the sum of all those numbers or just the even numbers, but you just won't understand my proofs or examples.In Java it would have been (warning: complete spoilers ahead)

This is what I have based on the other posters, clear and consice instructions that I actually learned somethign from, and is perfect minus the += at the end. I would like to get rid of the last plus. I learn better from example, not rabbit trails. I am deffinite your motive was sincere for me to figure it out on my own, but all you really did was make it difficult.

For the 100th time, I dont know where you getting this 1+2+3 thing. I never even needed that.

Rejecting everything you have never needed before is a very dangerous attitude. I'm out of this thread, you do it your way and please throw my two little methods away because you don't know how to use them and you never have needed them before.

Rejection

I only rejected that because you were being intentially persistent on including that when I was having an obviously tough time with just the one.

I dont know, it seems like your declaring a method within the main method here.. Im not even on methods.. I just need a simple loop. If your "COMPLETE spoiler" was what I was eventually suppose to acheive from your teaching style, Im not sure I would have ever got that. So feel free to not feel like you hindered me in anyway by showing off that you had some way of solving this equation in a method or without using a loop.

And even if I did understand how to use these methods, they are wrong. They dont print the even numbers.

I only rejected that because you were being intentially persistent on including that when I was having an obviously tough time with just the one.

I dont know, it seems like your declaring a method within the main method here.. Im not even on methods.. I just need a simple loop. If your "COMPLETE spoiler" was what I was eventually suppose to acheive from your teaching style, Im not sure I would have ever got that. So feel free to not feel like you hindered me in anyway by showing off that you had some way of solving this equation in a method or without using a loop.

And even if I did understand how to use these methods, they are wrong. They dont print the even numbers.

I am not a teacher, I simply volunteer here but my impression is that if you don't understand something you simply claim that the other person was wrong; I wasn't wrong but I'm not proud of it because it is all very old and solid knowedge, I simply studied it years ago. You were your own hindrance because of your stubborn attitude. Don't do that anymore because it'll kick back in the (near) future and it most certainly doesn't help when you want to learn how to program.

I just gave you two simple methods that can calculate the end result without a loop; you didn't understand what I was talking about but simply copied and pasted the code without knowing what you were doing. Nothing wrong with that but your conclusion that I was wrong is incorrect.

Thanks

In conclusion..

I didn't understand any of your suggestions or proof. I am sure they all come from sound, hard working, and experienced background. I just think your explanations are horrible. Perhaps point of reference issue. If it is standard for code to go in a code box that isn't how it is actually written in proper syntax, please show me how I am suppose to interpret it so I dont continue to do it incorrectly. When I give examples of HTML in code boxes to others on other forums, I put it exactly how it is suppose to be.. I guess I just wish you were more complete in your instruction. You spent more time negating "doing it for me" or how I was taking your instructions, you could have just given me one line of code. I could have disected it and actually learned something. I am sorry, but you wouldnt even answer specific questions I had in an attempt to TRY to understand your teaching. It doesnt matter how solid your background is, if your speaking in chinese and being overly vague in your instruction, and its obvious, I am not gonna catch on just because you point out that Im not catching on.

The ellipses (...) are a (more or less) official notation for a continuation, so the sum of all even numbers starting at 2 and ending at 98 is written as:

2+4+6+ ... +(2*49). <--Where did you get the 49 from. Where would I have gotten that from just reading instructions to write a program in Java that finds all even numbers between 0 and 98.

The sum of the first 'n' numbers (this is the general case) is written as:

1+2+3+ ... +n. <-- what is n here? You are adding n. Is n 1?

Centuries (milleniums actually) ago it was discovered that this sum equals:

n*(n+1)/2 <--what is "this sum" the sum from the previous example?

Try some small examples. So if the sum of the first 'n' numbers can be written as n*(n+1)/2 then twice this sum can be written as n*(n+1).

I cant try a small example if I dont understand the 3 previous sentences.

So, the sum of the first even numbers up to 98 is: <--the FIRST even numbers??? isnt it all the even numbers???

Ill ask a favor.. For the sake of this assignment, since I have already a working version now. Can you please start from the top. Explain to me the logic, and then show me each step in code... Explain some logic, then show more code, ultimatly the whole thing.

So if your saying 2+4+ n = 49 or whatever
the code is :

etc... Maybe I will be able to see how you were trying to explain to me so I can actually learn what I was doing wrong. If I didnt want to believe that you were right, I wouldnt even bother.. I just need it explained more complete and with example step by step. PLEASE

looking back.. I dont see how I would have ever stumbled upon the method way like your example from the information you gave. All you did was tell me the math. How do I write the syntax. what is the proper way to write that

Ill ask a favor.. For the sake of this assignment, since I have already a working version now. Can you please start from the top. Explain to me the logic, and then show me each step in code... Explain some logic, then show more code, ultimatly the whole thing.

So if your saying 2+4+ n = 49 or whatever
the code is :

etc... Maybe I will be able to see how you were trying to explain to me so I can actually learn what I was doing wrong. If I didnt want to believe that you were right, I wouldnt even bother.. I just need it explained more complete and with example step by step. PLEASE

I'll try to explain how the ancient Greeks figured this all out and I'll use a simple example: suppose you want to add the numbers 1+2+3+4+5+6+7. You can do it the simple way and do six additions but you can also do this: take enough pebbles and arrange them like this:

Java Code:

*
**
***
****
*****
******
*******

Every '*' represents a pebble. Now I'l add just as many pebbles and use the following arangement:

Java Code:

#######
*######
**#####
***####
****###
*****##
******#
*******

Both the '*'s and '#'s represent pebbles. There are 7x8 pebbles layed out in a rectangular shape; half of it is (7x8)/2 which is the sum of 1+2+3+4+5+6+7.
So if I have to add those seven numbers I could've done: 7*(7+1)/2.

Concluding, for every integer 'n' >= 0 the sum of all integers up to this value 'n' (whatever it is) is n*(n+1)/2.

Now you understand that sum of the numbers 1+2+3+ ... +n equals n*(n+1)/2. Multiply the numbers in that sum and that formula by two; you get:

2*1+2*2+2*3+ ... +(2*n) equals 2+4+6+ ...+(2*n) equals n*(n+1)

(try a few examples, e.g. n=5: 2+4+6+8+10 == 5*6). So if you have to add all the even number up to 98, the value of 'n' is 49 (see above). The sum of all those values is 49*50 which equals 2450. No loops needed.

Whoa

Now you understand that sum of the numbers 1+2+3+ ... +n equals n*(n+1)/2. Multiply the numbers in that sum and that formula by two; you get:

2*1+2*2+2*3+ ... +(2*n) equals 2+4+6+ ...+(2*n) equals n*(n+1)

(try a few examples, e.g. n=5: 2+4+6+8+10 == 5*6). So if you have to add all the even number up to 98, the value of 'n' is 49 (see above). The sum of all those values is 49*50 which equals 2450. No loops needed.

n=8 2+4+6+8+10+12+14+16 == 8*9

I take the last number.. Divide it by 2. Add one to it and multiply them together and I get the answer. So i understand these concepts. I saw the pebble example and quite a few other examples at