Bronium 512 August 21, 2012 Share August 21, 2012 (edited) 1 +2+3+4...+999998+999999+1000000 = 500000500000 So....Am I right? Edited August 21, 2012 by Bronium This one is a tad less creepy. Wouldn't you agree? Link to comment Share on other sites More sharing options...
Azura 1,107 August 21, 2012 Share August 21, 2012 No, it's 3,000,008. I have no idea how you got that number.. My Signature Shop!-=-=-=-=-Art Collection!-=-=-=-=-A Signature Tutorial! Also known as "Cloud Chaser". My Ponysona, Azura. Avatar & Signature by me. Link to comment Share on other sites More sharing options...
Bronium 512 August 21, 2012 Author Share August 21, 2012 No, you misunderstand me. Add every number from 1 to 1000000. That's what the ... means. Sorry, I accidentally wrote 999999 twice when it should've been 999998 + 999999 This one is a tad less creepy. Wouldn't you agree? Link to comment Share on other sites More sharing options...
Ashbad 969 August 21, 2012 Share August 21, 2012 1 +2+3+4...+999999+999999+1000000 = 500000500000 So....Am I right? #include <stdio.h> #include <stdlib.h> int main() { unsigned long long int acc = 0; for(int i = 1; i <= 1000000; i++) { acc += i; } printf("%llu", acc); return 0; } 500000500000 is what I'm getting, so seems you are indeed correct. What has fanfiction has Ashbad written lately? We should totally find out by clicking this link. (Protip, turn on "Show Mature" to see more) Link to comment Share on other sites More sharing options...
Bronium 512 August 21, 2012 Author Share August 21, 2012 Huzzah! Oh and the equation I got was (n+1)*(0.5n). Where n is the number you want to add up to. So far n is an element of N. Not sure of others just yet. Will update. Huzzah! Oh and the equation I got was (n+1)*(0.5n). Where n is the number you want to add up to. So far n is an element of N. Not sure of others just yet. Will update. 1 This one is a tad less creepy. Wouldn't you agree? Link to comment Share on other sites More sharing options...
Ashbad 969 August 21, 2012 Share August 21, 2012 Huzzah! Oh and the equation I got was (n+1)*(0.5n). Where n is the number you want to add up to. So far n is an element of N. Not sure of others just yet. Will update. If you want to solve these sorts of equations the non-fun way (as in, code aside), it's a simple sigma function, where i = 1 and n = 1000000. The formula for finding the summation is n(n+1)/2. Plug in your numbers: 1000000(1000001)/2 -> 500000500000 What has fanfiction has Ashbad written lately? We should totally find out by clicking this link. (Protip, turn on "Show Mature" to see more) Link to comment Share on other sites More sharing options...
Bronium 512 August 21, 2012 Author Share August 21, 2012 I wonder if (n+1)*(0.5n) works for negative numbers. Or is it just natural numbers? And this is the fun way ;.; This one is a tad less creepy. Wouldn't you agree? Link to comment Share on other sites More sharing options...
Ashbad 969 August 21, 2012 Share August 21, 2012 I wonder if (n+1)*(0.5n) works for negative numbers. Or is it just natural numbers? And this is the fun way ;.; Only works when i = 1. Otherwise, there are other equations for summation that you need to use. http://en.wikipedia.org/wiki/Summation What has fanfiction has Ashbad written lately? We should totally find out by clicking this link. (Protip, turn on "Show Mature" to see more) Link to comment Share on other sites More sharing options...
Bronium 512 August 21, 2012 Author Share August 21, 2012 Great, send me to wikipedia at 12am at night. And it's about maths. Dammit. This one is a tad less creepy. Wouldn't you agree? Link to comment Share on other sites More sharing options...
tanoshii 131 August 21, 2012 Share August 21, 2012 > sum[1..100000] => 5000050000 Haskell top lel Link to comment Share on other sites More sharing options...
thegoodhen 698 August 21, 2012 Share August 21, 2012 I'm sorry, but this trick has been actually found decades ago by one guy, not sure who... Fibonacci? Hm, something like that-he was a kid and their teacher told em to sum all nums up to 100. unsigned long long int acc = 0; unsigned long long int? "Mann learnt nie aus" as German ppl say-Basically, I just learned this is possible xD Link to comment Share on other sites More sharing options...
Ashbad 969 August 21, 2012 Share August 21, 2012 unsigned long long int? "Mann learnt nie aus" as German ppl say-Basically, I just learned this is possible xD Means to use a long of an integer as natively possible though if you're feeling ballsy, GCC suppports 128-bit integers as __int128. > sum[1..100000] => 5000050000 Haskell Biggest toy language ever made 1 What has fanfiction has Ashbad written lately? We should totally find out by clicking this link. (Protip, turn on "Show Mature" to see more) Link to comment Share on other sites More sharing options...
ProjectRKA 2,848 August 21, 2012 Share August 21, 2012 So, everypony... what is 5 times 2 ? Come on now, don't be shy :3 1 Link to comment Share on other sites More sharing options...
Bronium 512 August 21, 2012 Author Share August 21, 2012 It was Carl Gauss, I think. He counted up to a hundred and I wanted to make sure I could use his trick. I was just making sure that I was right. This one is a tad less creepy. Wouldn't you agree? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Join the herd!Sign in
Already have an account? Sign in here.
Sign In Now