[Novalug] does gedit have a length limit in its characters?

Igor Birman igor_birman@yahoo.com
Sat Mar 14 23:12:05 EDT 2015


There are 735 4 digit numbers in the first 100,000 digits of pi that occur 13 times!  You might want to change your pin :)
I wrote a simple javascript function to calculate:
var pi="3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783... (full 100000 at http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html
  var pins = {};
for (var i=0; i<pi.length; i++) {  var pin = pi.slice(i,i+4);  if (pins[pin] === undefined) {    pins[pin] = 1;  }  else {    pins[pin]++;  }}
Object.keys(pins).forEach(function(p){  if (pins[p] === 13) {    document.write(p + "<br/>");  }});

Igor 

     On Saturday, March 14, 2015 1:10 PM, Rich Kulawiec via Novalug <novalug@firemountain.net> wrote:
   

 On Sat, Mar 14, 2015 at 12:30:29PM -0400, pereira via Novalug wrote:
> 1: how do you get the file with the 100 k digits of pi?,
> and tells us what to do once you have the file,

A. Run this:

    wget "http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html" -O - > pi

That leaves you with an HTML file that has 100k digits of pi plus some cruft.

B. vi pi

Use the editor to throw away all the lines down to where pi starts,
and all the lines after it ends.  Then run this:

    :1,$!tr -d "\012"

which deletes all the newlines and leaves all the digits on a single line.

Alternatively, if you want to edit the file with something other than vi,
do the deletions mentioned above and then do this:

    tr -d "\012" < pi > pi.real
    mv pi.real pi

If I were going to do this more once, I'd probably write a script
which used sed and tr to do all this automagically, but for a one-off,
it's not worth it.

---rsk
---rsk
**********************************************************************
The Novalug mailing list is hosted by firemountain.net.

To unsubscribe or change delivery options:
http://www.firemountain.net/mailman/listinfo/novalug


   


More information about the Novalug mailing list