Describe and add

hv at crypt.org hv at crypt.org
Tue Sep 6 13:12:23 CEST 2005


Michele Dondi <blazar at pcteor1.mi.infn.it> wrote:
:On Thu, 18 Aug 2005 hv at crypt.org wrote:
:
:> Here's some perl code:
:>  perl -Mbigint -wle '$n=$a=1; while (1) { print "$n: $a"; ++$n; $a = desc($a) + $a } sub desc { my %a; ++$a{$_} for split //, shift; join "", map +($a{$_}, $_), sort { $a <=> $b } keys %a }'
:
:Oops! I hadn't noticed that you had already wrote a script for that. 
:Obviously I'm reading these mails very late.
:
:> Compute:
:[cut]
:> 9: 20314234480170281558
:> 10: 20317265802504533296
:> 11: 50431498946030705115
:[cut...]
:
:Hmmm, the outputs of our programs differ from some point on. Thus mine or 
:yours is wrong - this is not exclusive or: they may both be wrong...

Check Eric's original series of examples again: this is not Conway's
"look and say" type of description. My guess (as encoded in my perl) was
that the digits are sorted before describing, so that the description
of 212338 is 11222318. Replacing the desc() subroutine above with:
  sub desc { $_="$_[0]"; s/((\d)\2*)/length($1).$2/ge; $_ }
should give the sequence you expected.

It isn't clear whether I guessed the correct rule, nor whether Eric
actually intended what he wrote; Eric has promised clarification on
the issue, but I believe he's been away on a trip.

In principle both are perfectly valid sequences though.

Hugo





More information about the SeqFan mailing list