Re: Help with a recursive equation



KP wrote:
On Jun 30, 9:25 pm, ...<mensana...@xxxxxxx> wrote:
On Jun 30, 9:17?am, ... <mensana...@xxxxxxx> wrote:
On Jun 30, 3:43?am, KP <silverphoenix...> wrote:
[re S(n,m) = sum (k: k is an n-bit binary number with m 1-bits) ...
S(n,m) = S(n-1,m) + (2^(n-1))* C(n-1,m-1) + S(n-1,m-1)
....
[snip code + S(8,4) test run]
## ok, here's our answer, calculated recursively ## 8925
##
## now, check by actually summing
## the 8 bit numbers that have 4 1-bits (popcount) ## 8925

Another verification of S(8,4) is as follows. S(n,m) + S(n, n-m) =
C(n,m) * ((2^n) -1) because for each number with m 1-bits there's
a complementary number with n-m 1-bits, so S(8,4) = C(8,4)*255/2
= 35 * 255 = 8925.

....
I was looking for any pointers to the closed form solution of the
recursion.
Any pointers to methods or links would suffice if not the actual answer.
....
--
-jiw
.



Relevant Pages

  • Re: Help with a recursive equation
    ... instead of directly calculating C, ... For summing, the original formula appears ... I was looking for any pointers to the closed form solution of the ... recursion. ...
    (sci.math)
  • Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
    ... What matters is that Lisp teaches students to use ... recursion, because they have to. ... Java does NOT teach students to use ... pointers and recursion, she'll be able to understand anything, and get ...
    (comp.programming)
  • Re: Palindrome in Linked list
    ... > Of course recursion is efficient, you're basically using the stack as O ... > extra memory. ... But you don't of course need to reverse the entire list - just the first ... half - and you might just as well simply reverse the pointers as you go ...
    (comp.programming)
  • Re: How to write a program to track the value of a certain variable at run-time using debug feat
    ... If you are going to restrict your users in certain ways, ... The only API Linux debuggers use is ptrace. ... are pointers, then you must track not only that the pointer itself ... In order to understand recursion you must first understand recursion. ...
    (comp.os.linux.development.apps)
  • Re: Vandalism Spree in Van Nuys
    ... >>> Suffice it to say I don't think allowing your childred to jump on ... Bev ... To define recursion, ...
    (rec.autos.driving)