Good job Robert!. Your solution is more concise than mine. However, this
was the paper and pencil solution.....
rb =:]#~(' '~:]) NB. Remove all blanks
fun =. 3 : ' rb ":|.(a+b-1{y),(b=.*/0 2 {y),(a=.*/0 1 {y)'
fun 5 3 2
151022
fun 9 2 4
183652
fun 8 6 3
482466
fun 5 4 5
202541
fun 7 2 5
143547
I'm sure there is a more concise way to write
​my function, but I'm not good enough in J to shrink it any further.
Skip
On Sat, Dec 13, 2014 at 6:59 PM, robert therriault <[email protected]>
wrote:
>
> Hey Skip,
>
> I'm sure that there are more elegant ways but, here goes.
>
> fun=: 3 : 0
> ​'a b c'=. y
> ​(a*b*10000)+(a*c*100)+(a*b+c)-b
> ​)
> fun 5 3 2
> 151022
> fun 9 2 4
> 183652
> fun 8 6 3
> 482466
> fun 5 4 5
> 202541
> fun 7 2 5
> 143547
>
>
> Cheers, bob
>
>
> On Dec 13, 2014, at 3:17 PM, Skip Cave <[email protected]> wrote:
>
> > Oops! printing mistake...
> >
> > fun 5 3 2
> > 151022
> > fun 9 2 4
> > 183652
> >
> > fun 8 6 3
> >
> > 482466
> >
> > fun 5 4 5
> >
> > 202541
> >
> > fun 7 2 5
> >
> > ???
> >
> >
> >
> > 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm