Aha!  A dual:

   1j1&#&.": 12345
1 2 3 4 5

The fastest expression for obtaining the decimal digits is:
http://www.jsoftware.com/help/release/digits10.htm

   0"."0@": 12345
1 2 3 4 5



----- Original Message -----
From: Devon McCormick <[email protected]>
Date: Friday, April 29, 2011 5:48
Subject: Re: [Jprogramming] sum of digits in a number
To: Programming forum <[email protected]>

> You need to turn the result back into numbers after doing the 
> "filled copy"
> (1j1#):
> 
>    ".1j1#":12345
> 1 2 3 4 5
>    +/".1j1#":12345
> 15
> 
> 2011/4/29 Björn Helgason <[email protected]>
> 
> > 1j1#":12345
> >
> > 2011/4/29 bill lam <[email protected]>
> >
> > > one way is
> > >   ]a=. ".,.":12345
> > > 1 2 3 4 5
> > >    +/a
> > > 15
> > >
> > > project euler?
> > >
> > > Птн, 29 Апр 2011, Daniel Roe писал(а):
> > > >
> > > > If we add up the digits of the number 12345 we get 
> 1+2+3+4+5 = 15.
> > > > I want to be able to do math upon the individual digits.
> > > > How would I do that in J?

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to