Raul's solution was much faster than my original, though my argument to perm 
was not a constant,  so one alternative
# 10 #."1 /:~  ,/ (perm@#@{. {"_ 1 ]) 3 >:@:comb 9504

      From: Jimmy Gauvin <jimmy.gau...@gmail.com>
 To: programm...@jsoftware.com 
 Sent: Tuesday, August 15, 2017 1:47 PM
 Subject: Re: [Jprogramming] Quora problem
   
Completely agree with Skip as I'm also at the beginning of the learning
curve.

One of the idioms that really amazed me is the way Raul does the selection
of the combinations with the permutations using the table verb:

(perms 3) {"1 /    1+3 comb 9

I was working along similar lines with this selection expression:

(< a: ; p3) {    ; bc each 3+i.9

and now I'm wondering if there is any other way to apply the permutations
to the combinations


Jimmy

PS

p3 being the precomputed permutations and bc is a brutish approach for
generating 3 symbol base combinations.

  bc
3 : 'y ,. (1+#~1+i.y-2),. ;<\1+i.y-2'
  bc 5
5 2 1
5 3 1
5 3 2
5 4 1
5 4 2
5 4 3


On Tue, Aug 15, 2017 at 2:25 AM, Skip Cave <s...@caveconsulting.com> wrote:

> After studying the many diverse methods that were put forward to solve my
> "3-integers, no repeats or zeros" problem, I find I have learned quite a
> few new J idioms, as well as some new uses for familiar primitives. Thanks
> all so much for your efforts in all the solutions.
>
> Quora has hundreds of these "math quiz" types of problems posted in their
> forum. I have posted several of my own "brute force" solutions to various
> Quora math problems using J. I find that trying to solve these types of
> challenges is an excellent way to polish my J skills, as well as
> demonstrate the concise power of J. My proficiency in J is still a far cry
> from most of the participants on this forum, but I'm having fun learning.
>
> Skip
>
> Skip Cave
> Cave Consulting LLC
>
>
----------------------------------------------------------------------
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