Jay: Wow! i'll check this out tomorrow and get back to the list. Looks like a winner....Thanks.... On Jun 11, 2005, at 10:41 PM, Jay Reeve wrote: > Michael, > > Here's a method a bit less brutish. It let's you set your zero base > (i.e. what number will "AAA" represent), but it must be the same going > both directions. > > local fn numToTriplet$(num as long, zeroBase as long) > dim as str15 triplet > dim as long i, div > > num -= zeroBase > long if num < 0 or num > 17575 > stop str$(num + zeroBase) + "is out of range." > exit fn > end if > div = 676 > triplet[0] = 3 > > for i = 1 to 3 > triplet[i] = 65 + num \\ div > num = num mod div > div = div \\ 26 > next > > end fn = triplet > > local fn tripletToNum(triplet as str255, zeroBase as long) > dim as long i, num > > long if triplet < "AAA" or triplet > "ZZZ" > stop """" + triplet + """ is out of range." > exit fn > end if > num = 0 > > for i = 1 to 3 > num = num * 26 + triplet[i] - 65 > next > > end fn = num + zeroBase > > e-e > =J= a y > " > > On Saturday, June 11, 2005, at 02:59 PM, Michael Evans wrote: > >> Hello all... >> >> The integers: >> 1 to 17576 can be transformed into the triplets AAA to ZZZ >> 2 to 17577 can similarly be transformed into the triplets AAA to ZZZ >> >> The brute force, tedious and laborious, way of doing this: > > -- > > Cheers, ---------------------------- Michael Evans [SFSG] [HBPW] ----------------------------