f=: 1&<: + (^^:(1 2 3)1)&I.
   (f -: logstar) i.20
1
   (f -: logstar) 3814270+i.20
1
   (f -: logstar) (10^i.10) +/ 100?@$0
1

If logstar(1) is redefined to be 1 instead of 0, then f=: (^^:(i.4))&I.




On Mon, Jul 7, 2014 at 7:22 AM, Roger Hui <[email protected]> wrote:

> In practice log* (at least for base 2) can have only a very few values, so
> something involving I. should work quite well.
>
>
> On Mon, Jul 7, 2014 at 7:19 AM, Dan Bron <[email protected]> wrote:
>
>> Iterated log, usually written as log*(n), is defined piecewise as:
>>
>>                  +---------------------
>>                 / 0             if n<:1
>>         log*(n)=
>>                 \ 1+log*(log n) if n> 1
>>                  +---------------------
>>
>> This can be expressed directly in J using agenda (@.):
>>
>>         logstar =: 0:`(1+$:@^.)@.(1<:])"0
>>
>> But this feels fairly "procedural". All the work is in the recursion. Is
>> there a more elegant way to express it?
>>
>> -Dan
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to