38 #:~ COINS =:/:|. 1 5 2 5r2 2
0 6 0 0 2
   COINS #. 0 6 0 0 2 
38  
|                   ^
   38 #:~ COINS =:\:|. 1 5 2 5r2 2
0 0 4 1 2
   COINS #. 0 0 4 1 2 
38

I guess you would have to get also possible solutions and then remove any
with fractions.

Linda    

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of David Lambert
Sent: Saturday, January 25, 2014 8:34 PM
To: programming
Subject: [Jprogramming] #: antibase

    NB. convert 38 cents to pennies, nickels, dimes, quarters.

    38 #:~ COINS =: |. 1 5 2 5r2 2
1 1r2 1 3 0

    NB. why do I get a half dime and a nickel?

    COINS #. 1 1 0 3 0
38

----------------------------------------------------------------------
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