[Jprogramming] Extracting digits of Pi
Henry Rich
HenryHRich at nc.rr.com
Mon Mar 26 00:02:09 HKT 2012
Oops, for some reason I thought you wanted even and odd digits. To get
first and last, you can use
a=.10 #.^:_1 <. at o.10x^199
'first last' =. (<.-:#a) ({. ; }.) a
first
3 1 4 1 5 ...
last
9 8 2 1 4 ...
On 3/25/2012 10:29 AM, Henry Rich wrote:
> a=.<. at o.10x^199
> 'evendig odddig' =. |: _2 [\ 10 #.^:_1 a
> evendig
> 3 4 5 2 5 ...
> odddig
> 1 1 9 6 3 ...
>
> Henry Rich
>
> On 3/25/2012 6:19 AM, m l wrote:
>>
>> The verb<. at o.10x^n generates the n digits of Pi.
>>
>> Now, asign this to a variable, for example, a=.<. at o.10x^200 (n=200 in this case)
>>
>> How to extract the n/2 first digts and asign to another variable ?
>>
>> How to extract the n/2 last digits and asign to a variable ?
>>
>> Thanks.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list