If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ... z=26. Assume the input will be a single word, although it may mixed case. Note that A=a=1 and B=b=2.
So
s = 'hello'
means
p = 8 * 5 * 12 * 12 * 15 = 86400
Bonus question: How close can you get to a word product of one million?
For the bonus question (on OSX):
words= textread('/usr/share/dict/words','%s');
for k=1:numel(words)
wordprod(k) = word_product(words{k});
end
[~,i] = min(abs(wordprod-1000000));
words{i}
wordprod(i)
% curing with word product of 1000188
For the bonus question, we can rule out any number that has a prime factor greater than 26 (z). The product found by Jason Friedman is the first number greater than 10^6 that does not have such a prime factor. The product 999856 is the largest number less than 10^6 to be part of a possible solution.
I like playing with strings and ASCII table ;)
Everett appears to miss the fact that 1000000 has no prime factors above 26, and Jason's dictionary doesn't seem to include obsolete words. 'tetty' scores a perfect 1000000.
Well, if you happen to know someone named 'BettyJ', thus a first name of Betty, last initial J, this works: word_product('BettyJ').
Could you send me the answer?
I had benn worked for 1 week but Icouldnt find answer. İf anyone solves Please send answer. Really I need it.
easy ;)
'curing' returns 1000188.
Closest 10 words are 'curing', 'Nicaragua', 'comers', 'Moors', 'rooms', 'banquet', 'Arkansas', 'sulks', 'alkaline' and 'Canaveral'.
Words that make 1000,000, tetty and typey apparently, :)
Very clever way of converting to a number
closest I can get is 'curing', 188 away.
'god' equals 420.
large but working ;-)
'j' corresponds to 10 according to the code above so, the word that gives exaclty 1E+6 is 'jjjjjj'
% word_product('jjjjjj')=1E+6
I don't think that 'jjjjjj' is really a word...
Find the sum of all the numbers of the input vector
25620 Solvers
Find out missing number from a vector of 9 elements
207 Solvers
477 Solvers
255 Solvers
385 Solvers