I did not reed your specs well enough and you did not read my outcome well enough: (([EMAIL PROTECTED]&.(p:^:_1)@>: >./@: (<.&.^.) ])"0 -: _4&p:) 160+i.20 0
If I understand you correctly, you want the next odd prime power (including power 1) greater or equal than the input. Is that right? R.E. Boss -----Oorspronkelijk bericht----- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Yuvaraj Athur Raghuvir Verzonden: donderdag 21 september 2006 11:54 Aan: Programming forum Onderwerp: Re: [Jprogramming] Explicit to Tacit - newbie question Gotcha! ([EMAIL PROTECTED]&.(p:^:_1)@>: >./@: (<.&.^.) ])"0[ 25 23 fpp 25 25 25 2 5 2 which means that fpp does the following a) if input is prime -> return prime b) if not, find if it is a prime power -> return the base prime and the power c) if not keep incrementing (only odd numbers considered) -> until (a) or (b) is satisfied. Question was if (b) & (c) can be programmed tacitly. As it stands, your solution of finding the nearest prime is already available as a library function _4 p: _4 p: 25 23 _4 p: 25 + i.20 23 23 23 23 23 29 29 31 31 31 31 31 31 37 37 37 37 41 41 43 _4 p: 160+i.20 157 157 157 157 163 163 163 163 167 167 167 167 167 167 173 173 173 173 173 173 Regards, Yuva On 9/21/06, R.E. Boss <[EMAIL PROTECTED]> wrote: > > ([EMAIL PROTECTED]&.(p:^:_1)@>: >./@([^ <[EMAIL PROTECTED]) ])"0[160+i.20 > 157 157 157 163 163 163 163 167 167 169 169 169 169 173 173 173 173 173 > 173 > 179 > > [EMAIL PROTECTED]&.(p:^:_1)@>: NB. Hui's solution, excluding the first > (2) > <[EMAIL PROTECTED] NB. floor of prime log y > >./@([^ <[EMAIL PROTECTED]) NB. maximum of prime ^ floor of prime ^. > >y > > Since ^. and ^ are inverse of each other it can be reformulated to > > ([EMAIL PROTECTED]&.(p:^:_1)@>: >./@: (<.&.^.) ])"0[160+i.20 > 157 157 157 163 163 163 163 167 167 167 167 167 167 173 173 173 173 173 > 173 > 179 > > > R.E. BOSS > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
