January 29th, 2004, 5:31 pm
guys i am a new member and was kinda browsing through the forums....came accross this bunny problem. i think it is quite simple actually. Question: possible solutions of x and y from x+2y=nAnswer: ceil(n+1/2) i.e.if n is even, possible combinations are (n/2)+1if n is odd, possible combinations are (n+1)/2proof: 1.if n is even, x needs to be even also. possible solutions for x is (0,2,4...n/2) i.e a total of (n/2)+1 values. corresponding values for y can be trivially found2. if n is odd, x needs to be odd as well. possible solutions for x is (1,3...n) i.e. a total of (n+1)/2 values. check:let n=8. x can be (0,2,4,6,8)let n=9 x can be (1,3,5,7,9)