Kerl, John on Thu, 19 Feb 2004 19:52:30 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

RE: Pattern Match within PARI/GP

For what it's worth, this is precisely the sort of thing
Perl excels at.  E.g. gp > out.txt; perl out.txt
where does something like
$line=$_; print $line if $line =~ m/xyxyxy/;
Remember that Perl handles those massive datasets in the Human
Genome Project.

-----Original Message-----
From: Bill Allombert []
Sent: Wednesday, February 18, 2004 4:28 PM
Subject: Re: Pattern Match within PARI/GP

On Wed, Feb 18, 2004 at 12:18:21PM -0800, Paulo Ney de Souza wrote:
> Are there any (intelligent) pattern-matching routines in PARI/GP, or
> some other package developed on top of PARI ? Fo example, suppose one 
> want to look for the first occurrence of the pattern:
> 	xyxyxy
> in the first 1-million digits of Pi ... 

Not that I know of.

> I am doing this by brute force right now, but it occurs to me that 
> using something like Boyer-Moore or Knuth-Morris-Pratt may be more
> eficient ...

If you want to work with 10^6 digits, then you can afford to write
the output to a file and use a dedicated program to analyse the output.
Also there are probably more efficient programs than PARI for computing
1-million digits of Pi (and probably you can grab the digits on the net).