Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 21st, 2005, 4:26 AM   #1
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
Maths/Programming challenge

A chap came into work this morning with a puzzle for us to solve, here it is

G G J D G F F
G G G P B F F
G G B D G F F
-----------------
Z N Y H P B G

standard maths where you add down the coloum etc etc

but each lettar is a number between 0 and 9.

I dont no the answer myself (gonna work it out lunch time) just though you lot might want to have a go at it. I am currently writing a program to solve the problem as well.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Old Jun 21st, 2005, 4:54 AM   #2
HeX
Programmer
 
HeX's Avatar
 
Join Date: May 2005
Location: Kosova
Posts: 94
Rep Power: 4 HeX is on a distinguished road
Send a message via MSN to HeX
can you please provide more details, because how can it be 3G = Z, and at the same time 3G = N. This is possible only when Z and N are equal.
__________________
countdown++;
HeX is offline   Reply With Quote
Old Jun 21st, 2005, 5:32 AM   #3
TheFalseDragon
Programmer
 
TheFalseDragon's Avatar
 
Join Date: Jun 2005
Location: |\|[][]B |_4|\|D
Posts: 41
Rep Power: 0 TheFalseDragon is on a distinguished road
Y-1
G-2
B-3
D-4
F-4
J-5
Z-6
H-6
N-7
P-8
TheFalseDragon is offline   Reply With Quote
Old Jun 21st, 2005, 9:26 AM   #4
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
Dragon its wrong and to HeX dont you remember basic maths?

 
       1   9+
       2   4
       ------
        4  3

9+4 = 13 carry the 1 over to the other side? remember that stuff?


Dragon you can only use 1 number once eg all g's are 4 so 4 cannot be used for any other letter.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Old Jun 21st, 2005, 10:54 AM   #5
EdSalamander
Programmer
 
EdSalamander's Avatar
 
Join Date: Dec 2004
Location: Tucson, AZ, USA
Posts: 80
Rep Power: 4 EdSalamander is on a distinguished road
Send a message via AIM to EdSalamander
D=1
G=2
B=3
F=4
Y=5
Z=6
N=7
P=8
J=9
H=0

That was a fun way to start the day! Thanks Berto!

(FYI it's probably easier to just do the logic and write it out on paper than to write a program for it, it's not very hard really )
__________________
I can pick my friends. And I can pick my nose. So, why can't I pick my friend's nose?
EdSalamander is offline   Reply With Quote
Old Jun 21st, 2005, 2:39 PM   #6
TheFalseDragon
Programmer
 
TheFalseDragon's Avatar
 
Join Date: Jun 2005
Location: |\|[][]B |_4|\|D
Posts: 41
Rep Power: 0 TheFalseDragon is on a distinguished road
ye i was doing it in my head, i thought that i might have had to use each one once but i tried to just get an answer down
TheFalseDragon is offline   Reply With Quote
Old Jun 22nd, 2005, 12:50 AM   #7
Navid
Hobbyist Programmer
 
Navid's Avatar
 
Join Date: Feb 2005
Location: Canada
Posts: 187
Rep Power: 4 Navid is on a distinguished road
Send a message via MSN to Navid
one thing i noticed is that "J" can be anything really. So "Z", "N" and "Y" can be anything too. (or maybe im wrong)

For the rest, I just finished my math exam today so maybe next year

But i like these kind of problems, good logical programming practice. errr...sort of
Navid is offline   Reply With Quote
Old Jun 22nd, 2005, 3:22 AM   #8
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
Quote:
Originally Posted by navnav
one thing i noticed is that "J" can be anything really. So "Z", "N" and "Y" can be anything too. (or maybe im wrong)

For the rest, I just finished my math exam today so maybe next year

But i like these kind of problems, good logical programming practice. errr...sort of

Unfortunatly i think you are wrong as i have only found 1 answer to the question, and so therefore only 1 number for each letter.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Old Jun 22nd, 2005, 3:57 AM   #9
EdSalamander
Programmer
 
EdSalamander's Avatar
 
Join Date: Dec 2004
Location: Tucson, AZ, USA
Posts: 80
Rep Power: 4 EdSalamander is on a distinguished road
Send a message via AIM to EdSalamander
Well, the fact that you found only one solution doesn't mean there aren't more. That doesn't mean I don't agree with you though. There's only one solution. It rests mostly on the fact that P must equal 8. That established, 8 plus 2D must equal one of the other remaining digits excluding the carry it creates. All that remain at that point are 0, 1, 5, 7, and 9. Even trial-and-error is fast enough to show that D then must equal 1 and H equal 0. The next line up does the same thing only with J = 9 and Y = 5, since those are the only tho remaining digits that can be made to work around the other numbers (which sum up to 6 [3 + 2 + 1carry]).

..ok, so maybe this isn't perfectly clear after all, but there's no need to go overboard explaining it, so ill stop with a simple: Yes, Berto, there's only one solution. :p
__________________
I can pick my friends. And I can pick my nose. So, why can't I pick my friend's nose?
EdSalamander is offline   Reply With Quote
Old Jun 22nd, 2005, 5:56 AM   #10
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
well G has to be less than or equal to 3 - as 3G < 9
and it cant equal 0 as then Z would equal Zero.

3 numbers multiplied between 0 and 9 whoms answer is greater then 10 there are only 4 and 7 you can use (12 and 21) there is no 3 answer so g has to equal 2 or 3 and it just goes on from there,

i tried bopth 4 and 7 and only one fo them works
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:00 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC