20120220, 22:16  #1 
Oct 2011
7×97 Posts 
a puzzle
You have 680 glasses and need to build a tower 15 levels high with 1 on top. Is there an equation that can be used to solve for glasses per level?

20120220, 22:21  #2 
"Forget I exist"
Jul 2009
Dumbassville
2^{6}·131 Posts 

20120220, 22:37  #3 
Oct 2011
7·97 Posts 

20120220, 22:41  #4 
If I May
"Chris Halsall"
Sep 2002
Barbados
9579_{10} Posts 

20120220, 22:48  #5 
Oct 2011
1247_{8} Posts 

20120220, 22:50  #6 
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 89<O<88
1C35_{16} Posts 
Well the sum over the integers up to n := the nth triangular number would describe perfect triangles. So find the highest triangular number <= 680, then distribute the remainder evenly over each layer. In C:
Code:
int * pyramid(int x) { int i,j,diff; int sum=0; int * layer; printf("Input is %d\n", x); for( i=1; sum <= x; i++) sum += i; sum = (i); i; // The loop goes one too far, so fix it layer = (int *)malloc(i*sizeof(int)); // Declares an array of size i for( j=0; j<i; j++) layer[j] = j+1; // The basic shape is a triangle diff = x  sum; if( diff > 0 ) { for( j=i1; diff>0; diff /* Decrement diff until diff==0 */ ) { // Distribute the difference over each layer if( j<1 ) j = i  1; // Keep cycling over the pyramid layer[j]++; // Add one to the current layer j; // Move to the next higher layer } printf("There will be %d layers, as follows:\n", i); for( j=0; j<i; j++) printf("%d\n", layer[j]); printf("\n"); return layer; } else if( diff==0 ) {printf("A perfect triangle of glasses!\n\n"); return NULL;} else {printf("You need %d more debugging printfs!\n", x); return (int *)"YOU SUCK";} } Code:
What number of glasses should I use? 1 Input is 1 A perfect triangle of glasses! What number of glasses should I use? 2 Input is 2 There will be 1 layers, as follows: 2 What number of glasses should I use? 3 Input is 3 A perfect triangle of glasses! What number of glasses should I use? 4 Input is 4 There will be 2 layers, as follows: 1 3 What number of glasses should I use? 5 Input is 5 There will be 2 layers, as follows: 1 4 What number of glasses should I use? 6 Input is 6 A perfect triangle of glasses! What number of glasses should I use? 7 Input is 7 There will be 3 layers, as follows: 1 2 4 What number of glasses should I use? 8 Input is 8 There will be 3 layers, as follows: 1 3 4 What number of glasses should I use? 680 Input is 680 There will be 36 layers, as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 EDIT: WHOOPS 15 per layer. There's a HUGE piece of missing information. Well, at least I had fun solving my own problem :/ (Another edit: This is a 2D solution, as opposed to eh 3D ones below :P:P:P) Last fiddled with by Dubslow on 20120220 at 23:24 Reason: replaced code with working version 
20120220, 22:53  #7 
If I May
"Chris Halsall"
Sep 2002
Barbados
3·31·103 Posts 

20120220, 22:53  #8  
"Forget I exist"
Jul 2009
Dumbassville
2^{6}×131 Posts 
Quote:
Quote:


20120220, 23:00  #9 
Oct 2011
7·97 Posts 
Actually, that may work...
1+3+6+10+15+21+28+36+45+55+66+78+91+105+120=680 yep, that works... I was thinking 15x15,14x14, etc but it went well over 1k. With the levels now known, without using trial and error, is there an actual equation that would solve this? Last fiddled with by bcp19 on 20120220 at 23:02 
20120220, 23:13  #10  
Apr 2010
10010110_{2} Posts 
Quote:
Numbering the levels beginning with 1 at the top, the glass count for level i is the triangular number T(i) = i*(i+1)/2. The total glass count V(n) for n levels is then . And indeed V(15) = 680. Edit: OK, folks, you have been faster. Last fiddled with by ccorn on 20120220 at 23:16 

20120220, 23:21  #11 
Mar 2006
Germany
3^{3}×107 Posts 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Some puzzle  Harrywill  Puzzles  4  20170503 05:10 
Four 1's puzzle  Uncwilly  Puzzles  75  20120612 13:42 
4 4s puzzle  henryzz  Puzzles  4  20070923 07:31 
Dot puzzle  nibble4bits  Puzzles  37  20060227 09:35 
now HERE'S a puzzle.  Orgasmic Troll  Puzzles  6  20051208 07:19 