Thanks. Also, yeah I don't know why but I assumed it had to beatheist largest 9 
digit prime. I guess because all the other PE problems with pandigitals was for 
the 1-9 or 0-9. 

___________________________

David Vaughan

On 8 Jul 2011, at 16:03, Ric Sherlock <[email protected]> wrote:

> Let's forget tacit for now and just focus on the primitives
> 
>   1 p: i.15            NB. dyadic p: with a left argument of 1 tests
> for primality (see dictionary page for p:)
> 0 0 1 1 0 1 0 1 0 0 0 1 0 1 0
>   1&p: i. 15          NB. the & conjunction just binds the left
> argument to p: to create a new monadic verb (1&p:)
> 0 0 1 1 0 1 0 1 0 0 0 1 0 1 0
> NB. You could assign a name to the new verb
> isPrime=: 1&p:
> NB. this can be convenient but is not necessary
>   (1 p: i. 15) # (i. 15)
> 2 3 5 7 11 13
>   (i. 15) #~ (1 p: i. 15)   NB. the adverb Passive ( ~ ) swaps the
> left and right arguments
> 2 3 5 7 11 13
> NB. or if there is only a right argument
>   +~ 4
> 8
> In terms of the PE question, I think it might help to reread the
> question to make sure you are clear on the potential answers.
> 
> 
> On Sat, Jul 9, 2011 at 1:14 AM, David Vaughan
> <[email protected]> wrote:
>> I've found that method to be pretty simple in the end, using 10^i.9
>> Could you explain in:
>> (#~ 1&p:) i. 50
>> What's going on, particularly the role of ~ as I find that adverb confusing.
>> I know that p:y can be used to find the yth prime, but I don't understand 
>> why it tests for primes when 1& precedes it.
>> Thanks.
>> ___________________________
>> 
>> David Vaughan
>> 
>> On 8 Jul 2011, at 12:38, Ric Sherlock <[email protected]> wrote:
>> 
>>> Project Euler?
>>> 
>>> To get the permutations in reverse order you could reverse the string
>>> or reverse the list of permutation indicies. i.e.
>>>   0 1 2 3 A. 'cba'
>>>   3 2 1 0 A. 'abc'
>>> 
>>> In J you are better off testing the whole array of permutations rather
>>> than looping through them, so
>>>   (1&p: # ]) i. 50
>>> or
>>>   (#~ 1&p:) i. 50
>>> 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47
>>> 
>>> On Fri, Jul 8, 2011 at 10:53 PM, David Vaughan
>>> <[email protected]> wrote:
>>>> I'm trying to find the highest 1-9 pandigital prime, so I need to get the 
>>>> permutations in reverse order if possible. Also, how can I apply my 
>>>> primeTest script to the results?
>>>> 
>>>>   primeTest =: 3 : 'if. #@:q:y do. y end. '
>>>> This is what I have so far. The rank of y and of the list of permutations 
>>>> don't match up, and it feels like my 'if.' approach isnt great.
>>>> 
>>>> Can anyone offer any advice as to how achieve this?
>>>> 
>>>> Thanks.
>>>> 
>>>> ___________________________
>>>> 
>>>> David Vaughan
>>>> 
>>>> On 8 Jul 2011, at 11:29, Ric Sherlock <[email protected]> wrote:
>>>> 
>>>>> (i.@!@# A. ]) 'abcd'
>>>>>  or
>>>>> (A.~ i.@!@#) 'abcd'
>>>>> 
>>>>> see also:
>>>>> http://rosettacode.org/wiki/Find_the_missing_permutation#J
>>>>> 
>>>>> On Fri, Jul 8, 2011 at 9:44 PM, David Vaughan
>>>>> <[email protected]> wrote:
>>>>>> 
>>>>>> How would you go about getting all the permutations of a string in J?
>>>>>> ___________________________
>>>>>> 
>>>>>> David Vaughan
>>>>>> ----------------------------------------------------------------------
>>>>>> 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
>> ----------------------------------------------------------------------
>> 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