emperor: (Default)
posted by [personal profile] emperor at 11:38am on 27/12/2005
Consider a piece of code that does:

while(N>=g){
N=N-(g-1);
g=g-1;
}



ETA: I should mention (doh) that g>3 and N<=(g)(g-1)(g-2)/6

It seems to me that given N and g you ought to be able to just calculate the resulting values of N and g, without having to iterate.

Alas, I am too stupid to see how. Can anyone help?

October

SunMonTueWedThuFriSat
      1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
26
 
27
 
28
 
29
 
30
 
31