Sum of Natural Numbers

I was working on some code today which dealt with numbers.

It was about doing a sum of numbers from 1 + 2 + 3 + 4 + …. + N.

I am pretty sure this is known, but here is how it goes:

  • Odd numbers:

Suppose we are doing a sum of numbers 1 to N where N is an odd number.

Lets consider N to be number 5:

1 + 2 + 3 + 4 + 5 = 15

In the numbers above, 3 is in the center of the sequence, and 5 x 3 = 15. If N is 7 then 7 x 4 = 28 where 4 is at the center of the sequence.

But what if N is huge number like 12345. Finding the number at the center of the sequence is tough. When N was 5 the number at center of the sequence was 3, i.e. 5/2 + 1/2 = 2.5 + 0.5 = 3. This is also true for 7, 11, 13,… Therefore, when N is 12345:

12345/2 + 1/2 = 6173

So the sum of sequence 1 + 2 + 3 + 4 +….. + 12345 = 12345 x 6173 = 76205685.

i.e. For any given Number N, where N is odd, the sum of 1 to N is N x (N/2 + 1/2)

  • Even numbers:

Consider the same scenario when N is an even number. For eg:

1 + 2 + 3 + 4 + 5 + 6 = 21

1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36

Here when N is 6, 21 = (6 x (6/2)) + (6/2).

i.e. For any given number N, where N is even, the sum of 1 to N is (N x (N/2)) + (N/2)

All the above is just an observation, I dont have any proof (yet). It might exist already or I might have studied in school too, but dont remember now 🙂

Mobile Number Porting – Part 4

On 29th of March I got a call from Idea again:

Me: Hello?
Idea: Hello Sir. I am calling from Idea. You complained on twitter about number porting.
Me: Yes.
Idea: Can you explain what exactly is the issue.

— We discussed everything that I have written in first 3 posts. Also told him about my discussion and tweets with TATA —

Idea: Ok. I will forward this details to a concerned team here.
Me: Ok. When do you think this will be solved?
Idea: Tomorrow is Sunday, we will surely update you by Monday.
Me: Ok.

Later on that day @ideacellular tweeted this:

And this:

This time I was bit more confidant that the issue will be resolved soon.

Yesterday I got a call again:

Idea: Hello Sir I am calling from Idea.
Me: Yes tell me.
Idea: You complained on twitter about porting request.
Me: Yes.
Idea: Did you fill the form?
Me: I have filled the form and I also have the Idea SIM from over a month.
Idea: Where did you fill form from?
Me: Its a local mobile shop.
Idea: Where do you stay?
Me: Virar.
Idea: Ok. Can you hold on for a second?
Me: Sure.

— After some time —

Idea: Sir, thanks for being on hold. Virar doesnt come under Maharashtra or Mumbai coverage. You will have to goto Thane or Ulhasnagar and fill the form there in Idea office.
Me: I wont go anywhere. I have filled the form and I also have the SIM. If its possible with currently then do it or else leave it, I dont want to port my number.
Idea: Can you hold on again please?
Me: Sure.

— After some time —

Idea: Sir, you will have to goto Thane or Ulhasnagar to fill the form again.
Me: Leave it. I dont want to port my number.
Idea: Ok. Thank you for your time.
Me: Thanks.

Ok. So I am not porting my number to Idea. But now the question is, which SIM do I have with me? If it was never going to be ported, why did I get the SIM? Also did Idea lie that TATA is blocking my porting request? Because this doesnt look like TATA’s issue.

Mobile Number Porting – Part 3

TATA has tweeted that port out request is valid till April 8th:

Right now I am clueless on how this is going to happen. Day before yesterday I got a call from Idea repeating the same that TATA is blocking my port out request:

Idea: Hello Sir, You complained on twitter about your porting request.
Me: Yes.
Idea: Sir I want to let you know that its still blocked from TATA’s side.
Me: What?
Idea: Yes TATA doesnt want to leave you.
Me: But why? I am not even famous.
Idea: You will have to talk to TATA.
Me: Why dont you check their tweets, they have already mentioned that they have registered my port out request with some docket number.
Idea: No Sir. They are not accepting our request. You have to talk to them again.
Me: But why should I talk to them? I want my number to be ported to Idea and hence I filled your form.
Idea: Yes Sir we understand your concern. But we cant do anything.
Me: Do one thing, tweet to me and mention TATA that they have blocked my port out request.
Idea: Hmmm ok Sir.
Me: Thanks.

There was a tweet from @tatadocomo:

And I never got a call from them. Network problems?

One more tweet:

Alternate number? I never gave them any alternate number.