All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General > Word Problems
Numbered Letters (Posted on 2003-07-17) Difficulty: 3 of 5
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.)
Solution 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
Longest = adiabatically
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:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (23)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information