[no to] leading zeros / Quasipalindromes?

Marc LeBrun mlb at fxpt.com
Thu May 29 20:09:46 CEST 2003


(Sorry for the tardy reply to all this good discussion--I'm concatenating 
three responses and a tangential request)

 >=Richard Guy <rkg at cpsc.ucalgary.ca>
 > In `10', is the zero leading or trailing? R.

Excellent point!  (Here, a variant of the classic 
"big-endian/little-endian" issue).

Let me concur with David Wilson (more below) that the main problem here is 
one of terminology and notation.  We use words like "leading" and 
"palindrome" rather loosely.  To avoid our intuitive definitions always 
running aground on boundary cases these terms really ought to be exactly 
defined somewhere (eg in a glossary page?).

And (permit me to flog this hobbyhorse again) there's also a chronic 
confusion between number and numeral which sometimes afflicts the OEIS (the 
"base" keyword, or "decimal" in the comment, often, but not reliably, being 
symptomatic).

Since the OEIS is advertised as an *integer* codex the default assumption 
must be that the entries are about "quantities" or "magnitudes".  It's 
good, of course, that it also includes entries that, instead, essentially 
depend on representations as strings or symbols, but when this happens we 
need to be extra careful.

Note that if Richard had said just 10 instead of `10' a legitimate (though 
smartass) rejoinder would be to ask if he was referring to the "zero" 
written as 0 in the units position, or the "zero" "written" as a blank in 
the hundreds position.

The underlying issue is really whether we are just dealing, as usual, with 
the magnitude ten, or instead with its occasional representations: as a 
conventional finite decimal string, or its (implicitly) infinite "10-adic" 
representation, or any other, essentially symbolic, object that can somehow 
be printed using only digits.

Alas I can't propose any magic bullet to solve this.  I'm afraid we can 
only try to be especially alert whenever a sequence is defined in terms of 
some kind of representation, versus magnitudes, and somehow reflect that in 
the entry.  Suggestions?


 >="N. J. A. Sloane" <njas at research.att.com>
 > the majority of seqfans feel that 10 is not a palindrome.
 > here's the revised version of that sequence:
 > similar changes will probably need to be made to other
 > sequences with similar definitions.

It's more important that there's an unambiguous definition that can 
actually be cited somewhere than the exact details.  (After all, the 
majority of seqfans might vote differently when there's a recount!<;-).

When the "official" definition of a term doesn't quite fit a sequence then 
the differences can be more clearly indicated, or even (as David Wilson 
suggests) additional terminology introduced.

However I find the idea of *changing* existing sequences post facto to 
match a newly-minted definition alarming, since this kind of revision can 
disrupt the integrity of old entries and results (even published!) that 
depended on them.  I recommend in general changing *only* comments of 
existing sequences (unless of course there is a clear-cut error or similar 
editorial improvement).  Instead, where reasonable submitters may differ 
whole new sequences (appropriately cross-linked) ought to be added (eg 
A023416 versus A080791).


 >=David Wilson
 > The concept of "palindromes with possible trailing zeroes" crops up 
repeatedly.
 > What if we give them a name, say quasipalindromes?  Then we could use the
 > term to dispense with both "ignoring leading/trailing zeroes" and "0 if 
undefined"
 > babble, both of which I find distasteful.

 > The same problem with leading/trailing zeroes pops up in the closely allied
 > concept of digit reversals.  There are four possible variants, according to
 > whether we permit leading zeroes on the number and/or its reverse.  It
 > might be good to look at standards for that too.

I agree.  We could use some clear standard ways to express these concepts.

For myself, I was pleased to notice that my homebrew "rebase notation" 
b[x]q--which in its most elementary guise may simply be read as "replace b 
with q in the base-b expansion of x"--can express the core digit reversal 
operation as
   10[n](1/10)
(mod shifting by suitable powers of 10, etc).  Since it has a bunch of 
other uses (eg 10[n]1 sums the digits) I've adopted it as my personal 
"standard notation" for these operations.

But whatever new terms or notations are used, please define them 
exactly--"palindromes with possible trailing zeroes" is a good start, but 
it needs to be made exact or it'll just cause more trouble.


 > I also find this issue in digital permutations.  In my terminology, I 
tend to use
 > "permutation" if leading zeroes are allowed in the permuted number, and
 > "anagram" if not.  My logic is that an anagram of a word must be a proper
 > word, not a meaningless jumble of characters.  So that anagram of a numeral
 > must be similarly be a proper numeral, which typically does not include a
 > leading zeroes.  Tenuous logic, but useful.

I think this idea is good but the terms are backwards.  I believe "anagram" 
is generally understood to allow normal inter-word spacing, so we should 
probably call the "no insertions" operation a "permutation" instead.

Offered in evidence, a program (available at www.anagramgenius.com) finds 
the following anagrams (amongst hundreds of others) just for "encyclopedia":
   Nice code play
   Open delicacy
   Play nice, co-ed
   IO decency, pal
   I cleaned copy
   Ace policy den
   Can yodel epic
   Do an epicycle
   Dope in a cycle
   Ole! PC cyanide
   Lay piece on CD
   A conic, deeply
   ...

(By the way, can 10^p 10[n](10^q) mod 10^r-1 be made to produce arbitrary 
digit permutations of all n of a given "width" via suitable p,q,r?).


Tangential request: Could we try to append keywords to the Subject of 
messages refining given thread?  It makes searching and organizing them 
easier...

Thanks!















More information about the SeqFan mailing list