You may want to skip text entirely:

  +/"1(i.10)=/(5#10)#:35436
0 0 0 2 1 1 1 0 0 0
     
  (i.10)*+/"1(i.10)=/(5#10)#:35436
0 0 0 6 4 5 6 0 0 0
   
   (i.10)=/(5#10)#:35436
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 1 0
0 0 1 0 0
0 1 0 0 0
0 0 0 0 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
   
   +/"1(i.10)=/(5#10)#:35436
0 0 0 2 1 1 1 0 0 0
   
   (i.10)*+/"1(i.10)=/(5#10)#:35436
0 0 0 6 4 5 6 0 0 0
   
   +/(i.10)*+/"1(i.10)=/(5#10)#:35436
21

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jabran Noor
Sent: Monday, March 21, 2011 2:56 AM
To: [email protected]
Subject: [Jprogramming] Adding up digits in a long number

I want to add up the digits in a long 50-digit number.

Specifically, my question is

1. How to convert a number into a string... e.g. convert 12324343456456 into
a text format. I understand that using *":* works
2. Now, in the output from 1, I want to insert a blank space between each
letter. I am struggling to do that. I tried reshaping etc but not getting
the desired results. What is one single verb which will do the trick for me.
3. After that I will count the frequency of each number and multiply by the
number to get the total - This should not be difficult.

Help with 2 would be very useful.

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