All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Different Sums (Posted on 2004-07-22) Difficulty: 3 of 5
There are 40 ways to make sums of three distinct positive integers total 25. (1+2+22 is such a sum, but 1+12+12 and 1+2+3+19 are not.)

How many different ways can three distinct positive integers sum to 1000?

See The Solution Submitted by Brian Smith    
Rating: 3.2500 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re(2): With a little help from awk | Comment 3 of 17 |
(In reply to re: With a little help from awk by Sing4TheDay)

Touché -- but you also have to fix the second for(...), and avoid answers including a 0 ("positive integers")...


BEGIN {
total = 0;
for (A=1; A<=1000; A++)
{ for (B=A+1; B<=1000; B++)
{
C = 1000-A-B;
if (C>B) { total++; }
}
}
print total
}
The new answer is 82834. If I had run the program for 25, I would have noticed that it didn't produce a 40 as an answer...
  Posted by Federico Kereki on 2004-07-22 10:42:59
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information