Ok, my curiosity is up and I didn't google search this. But what is the purpose of this function. Saving bytes ? Some form of encryption? ~ steve On Jun 11, 2005, at 6:24 PM, Adam Bell wrote: > This works for me; Sorry it's an AppleScript, but you can see how > it goes; > > set triplet to "UGK" > set digits to {} > repeat with k from 1 to 3 > set digits to digits & ((ASCII number of character k of > triplet) - 65) > end repeat > set answer to 676 * (item 1 of digits) + 26 * (item 2 of digits) + > (item 3 of digits) + 1 > > == 13687 > > >> 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: >> ---------------------------------- >> clear local >> local fn tripLetsFromNums$(myNum as long) >> dim tripLets AS STR15 >> >> select aFolderNum >> case 1 >> tripLets = "000" >> case 2 >> tripLets = "AAA" >> case 3 >> tripLets = "AAB" >> case 4 >> tripLets = "AAC" >> //and on and on ad nauseam until ZZZ is reached. >> end select >> end fn = tripLets >> --------------------------- >> >> Now, using the fact that the letters A to Z are represented by the >> ASCII values 65 to 90 (Str$(65) = "A" to Str$(90) = "Z") can a >> more elegant and faster mathematical method be used to calculate >> tripLets? >> >> What would the analagous reverse process (fn numsFromTripLets& >> (tripLets AS STR15)) look like? >> >> The math/logic eludes me.... >> >> Cheers, >> >> ---------------------------- >> Michael Evans >> [SFSG] [HBPW] >> ---------------------------- >> >> -- >> > > -- > To unsubscribe, send ANY message to: futurebasic- > unsubscribe@...