When the beta version j807-c was announced yesterday, I decided to indulge in my hobby of playing with Pi (even though it was the day after Pi day...)
I've been trying some taxing problems on a machine that I have access to and one of the things I had done was to calculate the first 10 billion places of Pi. The package I used for this is found at http://www.numberworld.org/y-cruncher/ If you look there, calculating "only" 10e9 places of Pi is at the low end of what has been done - with the current record, set 3 years ago, being 13.3e12 digits. But even so, 10e9 digits are fun to play with. The above generating software creates a file of decimal digits (that is '3.14159...') and I used jmf to map my file of Pi. One of the amusing things to look at are repeating digits in Pi, as described in the article https://en.wikipedia.org/wiki/Six_nines_in_pi Here is a view of my tinkering. [jkt jstuff]$ ja pi.ijs JVERSION Engine: j806/j64/linux Release: commercial/2017-11-06T09:54:01 Library: 8.06.09 Platform: Linux 64 ... require 'jmf' 2 map_jmf_ 'pi';'/home/jkt/Documents/jstuff/Pi1e10.txt';'';1 52 {. pi 3.14159265358979323846264338327950288419716939937510 $pi 10000000002 ts NB. returns time and space used 6!:2 , 7!:2@] rl NB. calculates run lengths [: #;.1~ 1 , 2 ~:/\ ] hist NB. produces histogram ~. ,: #/.~ NB. getting a histogram of run lengths hist rl 52 {. pi 1 2 46 3 NB. that is, 46 run lengths of 1 and 3 of 2 NB. finding repeating sequences (52{.pi),: 1": #~ rl 52 {. pi 3.14159265358979323846264338327950288419716939937510 1111111111111111111111111221111111122111111112211111 NB. looking at more digits of Pi we see hist rl 800 {. pi 1 2 3 6 659 63 3 1 NB. interesting lack of lengths 4 and 5 - to find where the 6 is I. 6 = #~ rl 800 {. pi 763 764 765 766 767 768 (I. 6 = #~ rl 800 {. pi) { pi 999999 hist #~ rl 800 {. pi 1 2 3 6 659 126 9 6 NB. that is 659 1, 63 2, 3 3, and 1 length 6 NB. looking at considerably more digits hist rlx=. #~ rl 2.5e9 {. pi 1 2 3 6 4 5 7 8 9 10 2024994929 405013256 60757176 121002 8086620 1010945 14154 1728 180 10 NB. So, 20167 runs of length 6, 20 of 9, and only 1 of 10 I. 10 = rlx 386980413 386980414 386980415 386980416 386980417 386980418 386980419 386980420 386980421 386980422 20 {. (386980413-5) }. pi NB. the limiting thing in this search for runs are the space used by the integers e.g. 7!:5 <'rlx' 3.43597e10 NB. the vector of lengths takes 34.4 Gbytes of space... so I had to fiddle a bit to NB. find the histogram for 10e9 digits - using the results from above we can do 20 {. (386980413-5) }. pi 43705666666666691436 NB. and we see the run is sixes. So we are into the area of speed ups in j807 and timing shows ts '20 {. (386980413-5) }. pi' 2.65659 1.71799e10 NB. without describing my fiddling to learn that there are 8 length 10 runs in the first 10e9 digits NB. the last such sequence starts at location 9074607643 so, having a look (and timing) 20 {. (9074607643-5) }. pi 51593666666666614571 ts '20 {. (9074607643-5) }. pi' 0.261949 1.07374e9 NB. interesting that it takes 17 times less space and 1r10 the time to find the last one I think this is NB. due to the fact that we are dropping almost all the digits before taking our 20, saving copies. exit 0 ~~~ So (finally...) to compare the last two {.}. results from j806 to j807 - [jkt jstuff]$ jb pi.ijs JVERSION Engine: j807/j64/linux Beta-c: commercial/2018-03-13T10:30:41 Library: 8.07.08 Platform: Linux 64 ... require 'jmf' 2 map_jmf_ 'pi';'/home/jkt/Documents/jstuff/Pi1e10.txt';'';1 20 {. (386980413-5) }. pi 43705666666666691436 ts '20 {. (386980413-5) }. pi' 6e_6 1472 2.86242 1.71799e10 2.86242 1.71799e10 2.86242 1.71799e10 % 6e_6 1472 477070 1.16711e7 NB. even when j806 was faster (on the last 10 run), j807 is still impressively faster 20 {. (9074607643-5) }. pi 51593666666666614571 ts '20 {. (9074607643-5) }. pi' 6e_6 1472 0.261949 1.07374e9 % 6e_6 1472 43658.2 729443 exit 0 ~~~ All that blather to say that in the two examples, using the new {.}. in j807 was 43658 to 477070 times faster and took 729443 to 1.16711e7 times less space. Nice! Finding the other 6 length 10 runs (and what digits they are) in the first 10e9 digits of Pi is left as an exercise for the reader. ;-) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
