Hi,
Thx for help.
> Try something like this:
>
> f(n0,d):=block([ni : n0,k : 1],
> while (ni : doubling_map(ni,d)) # n0 and k < 100 do (
> k : k + 1),
> if k = 100 then 0 else k)$
It works well. (:-)
What is the rule that makes your program works and my do not ?
Is it :
- define index variable
- give it the initial value
- use as an index ?
Adam
>
> Barton
>
> -----maxima-bounces at math.utexas.edu wrote: -----
>
>
>> Can it be done better ?
>>
>
>> /* this second function works */
>> GiveP(n0,d):=block(
>> [ni:n0,i:0],
>> block(
>> loop,
>> ni:doubling_map(ni,d),
>> i:i+1,
>> if i<100 and not (n0=ni) then go(loop)
>> ),
>> if (n0=ni)
>> then i
>> else 0