[seqfan] Re: Need more terms for the Linus and Sally sequences

hv at crypt.org hv at crypt.org
Tue Jun 23 11:59:28 CEST 2015


I see that Robert Israel and T. D. Noe have also been working on this,
but I've uploaded my results anyway; I'm not sure if that's a breach
of etiquette, apologies if it is.

The approach I used was to take advantage of perl's regular expression
capabilities, coupled with the realisation that perl can optimize patterns
anchored to the start far better than those anchored to the end - reversing
the string to allow that gave a speedup of several orders of magnitude:

my $string = "";
digit('1', 0);
for (2 .. $limit) {
    my($repeat, $digit) = ($string =~ m{ ^ (.*) ([12]) \1 }x) or die;
    digit($digit eq '1' ? '2' : '1', length($repeat) + 1);
}

sub digit {
    my($digit, $repeat) = @_;
    $string = $digit . $string;
    # n A6345(n) A6346(n)
    printf "%s %s %s\n", length($string), $digit, $repeat;
}

This takes about 45s to calculate 50,000 terms of both sequences.

Hugo

I wrote:
:I have these calculated, just checking the results and I'll upload them.
:
:Hugo
:
:Neil Sloane <njasloane at gmail.com> wrote:
::Dear Seq Fans,
::Going through my old correspondence files
::(Kellen Myers is helping me scan in some of the crucial unpublished
::historical material, which we are adding to the appropriate
::entries), I came across the original letters from Nathaniel Hellerstein
::concerning A006345 and A006346 (scans of some
::of this will be added to the OEIS soon)
::
::In one letter from 1978 he sent me 20000 terms of those two sequences
::on computer printouts.  The present b-files
::only give 1000 terms.  It would be nice to show that we can
::do better.  Could someone produce 20000-terms b-files, or even
::50000-term b-files?
::
::Best regards
::Neil
::
::Neil J. A. Sloane, President, OEIS Foundation.
::11 South Adelaide Avenue, Highland Park, NJ 08904, USA.
::Also Visiting Scientist, Math. Dept., Rutgers University, Piscataway, NJ.
::Phone: 732 828 6098; home page: http://NeilSloane.com
::Email: njasloane at gmail.com
::
::_______________________________________________
::
::Seqfan Mailing list - http://list.seqfan.eu/



More information about the SeqFan mailing list