 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Numbered Letters (Posted on 2003-07-17) If each letter has a value (a=1, b=2, c=3 etc.) what words have a total letter value of exactly 100 when you add up all of the letters?

Are there any words that equal 100 if the letter values are swapped (z=1, y=2.....a=26)?

 See The Solution Submitted by Lewis Rating: 3.2857 (7 votes) Comments: ( Back to comment list | You must be logged in to post comments.) Programming Solution | Comment 9 of 28 | I wrote the following small javascript program to find all the possible words. I used the ENABLE word list, which is just a text file of all acceptable Scrabble words, also used often for programming purposes such as this. Here is the first program:

list="aa aah aahed (ENABLE LIST) ... zymurgy zyzzyva zyzzyvas";
words=list.split(" ");
var count=0, long=0, short=100;
for (i=0; i<words.length; i++) {
var word=words[i];
var total=0;
for (c=0; c<word.length; c++) {
char=word.charAt(c);
value=word.charCodeAt(c)-96;
total+=value;
}
if (total==100) {
document.write(word + ", ");
count++;
if (word.length<short) {
short=word.length;
shortest=word;
}
if (word.length>long) {
long=word.length;
longest=word;
}
}
}
document.write("<br><br>Total words: " + count);
document.write("<br>Longest = " + longest);
document.write("<br>Shortest = " + shortest);

This will take each word in order and add up the value of its letters, count the total number of matches, and keep track of the longest and shortest words found.
charCodeAt is a function that returns the ASCII value of a letter (starting with a=97).
Then, to find the reverse order, I changed the (value=..) line to:

value=123-(word.charCodeAt(c));

Both lists are way too long to post here. The results were:

Forwards (a=1...z=26):
Total words: 1921
Shortest = nutty

Backwards (a=26...z=1):
Total words: 1263
Longest = luxuriously
Shortest = caca

 Posted by DJ on 2003-07-17 17:10:34 Please log in:

 Search: Search body:
Forums (0)