[algogeeks] Re: A efficient algorithm for digit sum?

2007-09-27 Thread Mgccl
how can that array be constructed efficiently? convert binary to that base? On Sep 27, 4:02 am, MD <[EMAIL PROTECTED]> wrote: > If we have enough memory.. we could probably have a array to hold > values for > numbers in each base and sum it and output the value.. :) efficiency > at the cost of me

[algogeeks] Re: A efficient algorithm for digit sum?

2007-09-27 Thread MD
If we have enough memory.. we could probably have a array to hold values for numbers in each base and sum it and output the value.. :) efficiency at the cost of memory. On Sep 25, 5:12 pm, Mgccl <[EMAIL PROTECTED]> wrote: > is there a known, efficient digit sum algorithm exist for any base. > In

[algogeeks] Re: A efficient algorithm for digit sum?

2007-09-26 Thread [EMAIL PROTECTED]
The only algorithm I'm aware of is : digitsum(N,base) : sum = 0 while N != 0 sum = N % base N = N / base return sum which obviously isn't efficient. On Sep 26, 2:12 am, Mgccl <[EMAIL PROTECTED]> wrote: > is there a known, efficient digit sum algorithm exist for any base.