DNN Designer
Wednesday, March 10, 2010   Login | Register  Search
You Are Here > Google Send a Fax Problem
 
HomeBackgroundServicesContactPresentations & ArticlesTech Talk
Download Code Minimize
Google Labs Send A Fax Problem Minimize

Here was the problem as printed in the Communications of the ACM, August 2004:

To Send a Fax

Dial the four-digit access code Y where 60097 equals f(f(f(Y))).

This machine has extension number Z where f(f(Z)) = 1.

(If you forgot your orientation packet, E(x) = number of letters when x is written out in American English f(x) = 3[E(x)]^3 - x.

Y=2465

Z=6808

I figured out the problem using the brute force method. I simply wrote a program that tried all values from 1000-9999 since you know it was a 4 digit access code.

The only tricky part was the algorithm for converting a number into words, luckily only the length was needed so it didn't have to read logically out loud. Here is the basic algorithm: pseudo code:

Function int E(int x)

while x>0

currentNumber = x mod 10

x = x div 10

Keep track of power of ten you're dealing with

tempString = tempString & Convert currentNumber to words (watch out of zeroes and add extra words for each thousands separator group)

end while

Return length of tempString

End Function

Home
Background
Services
Contact
Presentations & Articles
Tech Talk
keyboard
Home | Background | Services | Contact | Presentations & Articles | Tech Talk
Copyright 2006 by My Website | Terms Of Use | Privacy Statement
DNN Designer