Hello;
Lacking the case where an individual item has a sum <10,
+/ 9| 10 3 112 16 7
22
But the problem so far seems undefined otherwise:
+/ 9| 85 334
5 NB. should it be 23 = 13 + 10 ?
Arie Groeneveld wrote:
+/,.&.": 10 3 112 16 7
22
Dan Bron schreef:
I wrote:
usual metrics apply: novelty, brevity, velocity, and parsimony.
I'm most interested in an elegant way to rephrase sum-of-the-digits:
+/@:,@:(#.^:_1)
Can you come up with a better way? Example:
10 +/@:,@:(#.^:_1) 10 3 112 16 7 22
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
------------------------------------------------------------------------
|\/| Randy A MacDonald | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ | | The only real problem with APL is that
BSc(Math) UNBF'83 | it is "still ahead of its time."
Sapere Aude | - Morten Kromberg
Natural Born APL'er |
-----------------------------------------------------(INTP)----{ gnat }-
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm