MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Strange 26base enumeration


Oooo.  Nice little morning puzzle to wake my brain up.

At first, it looked like an easy solution using IntegerDigits, but ran
into a problem that this isn't a true digit system, in that it does
not have a zero.  I had to add a little logic to deal with that.  Try
this:

ToExcelColumn[n_Integer] := Module[{id},
    id = IntegerDigits[n, 26] //. {pre___, d_, 0, post___} :>
         {pre, d - 1, 26, post} //. {0, post___} :> {post};
     StringJoin[id /. Thread[Range[1, 26] -> CharacterRange["A",
          "Z"]]]];

Map this function onto a range starting at 1 and you will get your
table.

Enjoy,
Daniel


  • Prev by Date: Re: Hatched shading?
  • Next by Date: Re: Hatched shading?
  • Previous by thread: Re: Strange 26base enumeration
  • Next by thread: Re: Strange 26base enumeration