Juggling Pi as a siteswap.—strach
Re: Pi as a siteswap.
Wed, 13 Apr 2005 12:48:47 +0000
Guy G <guy.griffi...@rdg.nospam.ac.uk>

Although it’s stored as 2 digits per byte, there’s a program there which converts it for you. It compiled straight away for me, but it reads from stdin and writes to stdout, and I’ve no idea how you’d run it in windows. For anyone that wants to try it in Linux, the command is something like this:

    gcc unpack_pi.c    cat pi100m.hexbin.000 | ./a.out 1 100000000 > pi100m.txt

Oh, and then you need to remove the spaces and newlines (possibly), but some basic perl code will do that for you[1]:

    #!/usr/bin/perl    open(IN,"pi100m.txt");    open(OUT,">pi100mformat.txt");    print OUT "3";    while(<IN>){         s/\s//g;         s/\n//g;         print OUT $_;    }

The program I wrote searches for a range of periods, but it’s very slow. I’m going to have lunch now, so I’ll download your new program and run it on 100 million digits and see how it goes.

Guy

[1] Little Paul, if you’re reading this, I don’t give a toss if it’s a waste of characters.—Guy

It compiled straight away for me, but it reads—strach

type in cmd window

program.exe < file.in program will read file.in as stdin program.exe > file.out as above, but stdout program.exe < file.in > file.out, and here you have what you need—strach

while<STDIN>{s/\s|\n//g;print$_;}

You’re just not trying are you.—Little

perl -pe ’s/\s//g’ pi100m.txt > pi100mformat.txt

N.B. \n is part of \s, so \n|\s is overkill

How’s that for a try ? What about this for the whole deal ?

gcc unpack_pi.c && ./a.out 1 100000000 < pi100m.hexbin.000 | perl -pe ’s/\s//g’ > pi100mformat.txt—Kelhoon

 
 
 
 

The perl? Or the unnescessarilly large amount of previous post that you quoted? ;-)—Little

The perl. —Guy