PARI/GP code for sequence transforms

Christian G. Bower bowerc at usa.net
Fri Dec 14 03:51:45 CET 2007


series returning a vector. The names of the transforms themselves need
sequence for all transforms, but the code to implement it (especially if the
  if(type(A) == "t_VEC", return(trv_euler(A)));
  if(type(A) == "t_MAT", return(trm_euler(A)));
see several hundred soon. Also, I'm sure many PARI users on this list have
same way. The problem is that some combinatorial assembly transforms have a
should be the focal point and send updates to Neil when necessary (assuming he
Return-Path: <hv at zen.crypt.org>
X-Ids: 165
Message-Id: <200712141057.lBEAvN97012541 at zen.crypt.org>
To: seqfan at ext.jussieu.fr
cc: "Giovanni Resta" <g.resta at iit.cnr.it>, "Max Alekseyev" <maxale at gmail.com>
Subject: Re: a property of multisets: unit fractions with a twist 
From: hv at crypt.org
In-Reply-To: <d3dac270712111818o43226c08g19fa83154be1334e at mail.gmail.com>
Date: Fri, 14 Dec 2007 10:57:23 +0000
Sender: hv at zen.crypt.org
X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-3.0 (shiva.jussieu.fr [134.157.0.165]); Fri, 14 Dec 2007 13:01:34 +0100 (CET)
X-Virus-Scanned: ClamAV 0.88.7/5116/Fri Dec 14 08:14:39 2007 on shiva.jussieu.fr
X-Virus-Status: Clean
X-Miltered: at shiva.jussieu.fr with ID 4762709B.009 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)!
since p.q will often have many small divisors. I don't know if there is
sub A118085 {
  my $length = shift;
  die "This code not suitable for length < 2.\n" if $length < 2;
  return A118085_r($c2, $c1, $c0, $length);
sub A118085_r {
  my($p, $q, $prev, $len) = @_;
  my $diff = $p - $q;
  return 0 if $diff <= $c0;
  my $count = 0;
  if ($len == 2) { 
    if ((my $gcd = gcd($q, $diff)) > $c1) {
      $_ /= $gcd for ($diff, $p, $q);
    }
    my $pq = $p * $q;
    if ($diff > $c1) {
      my $modv = (-$q) % $diff;
      my $min = $prev * $diff - $q;
      for my $d (@{ divisors($pq) }) {
        next if $d < $min; 
        last if $d * $d > $pq;
        next if $d % $diff != $modv;
        # I suspect dividing by gcd means following check is not needed
        next if ($pq / $d) % $diff != $modv;
        ++$count;
      }
    } else {
      my $min = $prev - $q;
      for my $d (@{ divisors($pq) }) {
        next if $d < $min; 
        last if $d * $d > $pq;
        ++$count;
      }
    }
  } else {
    my $next = 1 + int(($q - $c1) / $diff);
    $next = $prev if $next < $prev;
    for (my $curr = $next; 1; $curr = $next) {
      ++$next;
      last if $p * ($curr ** $len) > $q * ($next ** $len);
      $count += A118085_r($p * $curr, $q * $next, $curr, $len - 1);
    }
  }
  return $count;
Return-Path: <davidwwilson at comcast.net>
X-Ids: 165
X-Authority-Analysis: v=1.0 c=1 a=2o10aY6ksaGw3-YPKngA:9 a=Y3t7HgKk_fXTfYFw5eDOUlRuRfcA:4 a=MSl-tDqOz04A:10 a=rC2wZJ5BpNYA:10 a=XF7b4UCPwd8A:10
Message-ID: <003201c83e4f$b9ec0390$6401a8c0 at yourxhtr8hvc4p>
From: "David Wilson" <davidwwilson at comcast.net>
To: "Sequence Fans" <seqfan at ext.jussieu.fr>
References: <5542af940712081551m435e6055gf9ee535f9ba389ff at mail.gmail.com> <3c3af2330712110439k33c2347i316d78f3725b8186 at mail.gmail.com>
Subject: Re: Ternary analogue of A094913?
Date: Fri, 14 Dec 2007 07:49:10 -0500
MIME-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="iso-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-3.0 (shiva.jussieu.fr [134.157.0.165]); Fri, 14 Dec 2007 13:49:13 +0100 (CET)
X-Virus-Scanned: ClamAV 0.88.7/5117/Fri Dec 14 12:59:16 2007 on shiva.jussieu.fr
X-Virus-Status: Clean
X-Miltered: at shiva.jussieu.fr with ID 47627BC7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)!

The sequence in question is not about binary number, it is a sequence about 
strings over a 2-character alphabet encoded as binary numbers, and does not 
concern the numerical values of the elements.  It is more akin to "necklaces 
having beads of 2 colors".

----- Original Message ----- 
From: "Maximilian Hasler" <maximilian.hasler at gmail.com>
To: "Jonathan Post" <jvospost3 at gmail.com>
Cc: "seqfan" <seqfan at ext.jussieu.fr>; "jonathan post" <jvospost2 at yahoo.com>
Sent: Tuesday, December 11, 2007 7:39 AM
Subject: Re: Ternary analogue of A094913?


> If you go on to base 3, then the door is open to do it in any base... 
> :-( !






More information about the SeqFan mailing list