e607 =: <: 2x ^ 607    NB. define e607 to eliminate its time
overhead

pp0=: *./@(0&<@#, 2&<:, 1 < +./)@(#/....@q: ::0:"0)

pp0 e607

takes about the same time as

# q: e607


----- Original Message Follows -----
From: Joey K Tuttle <[email protected]>
To: Programming forum <[email protected]>
Subject: Re: [Jprogramming] perfect power???
Date: Mon, 8 Jun 2009 10:56:04 -0700

>Only a silly 1% longer - 99% of the time is taken by q:
>determining  that <:2x^607 is a prime... (I'm impressed
>that it does :)
>
>And only one segmentation fault in poking at it... :(
>
>
>At 09:38  -0800 2009/06/08, [email protected]
>>wrote: Thanks for the help.
>>
>>I haven't really timed it, but it seems that doing:
>>
>># q: <: 2x ^ 607
>>
>>is just about as fast as doing
>>
>>pp0 <: 2x ^ 607
>>
>>
>>----- Original Message Follows -----
>>From: Raul Miller <[email protected]>
>>To: Programming forum <[email protected]>
>>Subject: Re: [Jprogramming] perfect power???
>>Date: Mon, 8 Jun 2009 12:09:15 -0400
>>
>>>On Mon, Jun 8, 2009 at 10:39 AM,
>>>>  <[email protected]> wrote: I would not
>>>>think it was simpler, but if the verb returned:
>>>>  1 - "IS" perfect power
>>>>  0 - "IS NOT" perfect power
>>>>
>>>>  that would be fine.
>>>
>>>Both Mike Day's and my own solutions work this way:
>>>
>>  >   pp0=: *./@(0&<@#, 2&<:, 1 < +./)@(#/....@q: ::0:"0)
>>>
>>>    pp0 4
>>>1
>>>    pp0 5
>>>0
>>>
>>>FYI,
>>>
>>>--
>>>Raul
>>>---------------------------------------------------------
>>>-- ----------- For information about J forums see
>>>http://www.jsoftware.com/forums.htm
>>----------------------------------------------------------
>>------------ For information about J forums see
>http://www.jsoftware.com/forums.htm
>
>-----------------------------------------------------------
>----------- 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