468,484 Members | 1,761 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,484 developers. It's quick & easy.

Cryptarithmetic Help

hey guys have got any idea of how to write a code for CRYPTARITHMETIC on --- PROJ + GOOD = EASY
Oct 4 '06 #1
3 3302
144 100+
Your question makes no sense. You need to be more specific, and word it better. My impression is you are working on a project that needs decent crypto support that is fairly easy to implement.
Oct 4 '06 #2
9,055 Expert Mod 8TB
I get the impression that he is trying to solve the alphametic puzzle

Expand|Select|Wrap|Line Numbers
  1.  PROJ
  2. +GOOD
  3. -----
  4.  EASY
Which has multiple (100) solutions.

The brute force way is to assign digits to each letter in a loop and check the result to see if it is correct outputing correct results.
Oct 4 '06 #3
293 100+
Well there are 10 letters, ADEGJOPRSY, and I assume it's in decimal. Typically, each letter is unique. If it's in hexadecimal or a higher base, then it becomes much more difficult. You can think A has 10 possible values, D has 9 possible values, E has 8, and as a result there are 10! or 3628800 possibilities, assuming it's base 10 arithmetic.

There is some information though, for example G+P+carry = E <= 9, carry either being 0 or 1. As a result, G and P are not 9, possibly not 8. Each number is four letters/digits long, and I would focus on the carries. Each digit either has a carry or not a carry, and that gives 8 possibilities.

Take the least significant digits, D+J = Y. If there is no carry, then 0 < D,J < Y <= 9. D and J must be nonzero, otherwise D = Y or J = Y. That hinges on the uniqueness requirement. Also, 2*O = S. Otherwise, 0 <= Y < D,J <= 9 and O+O+1 = S.

If the problem is in decimal, then there must be at least one carry that causes a result to be zero. Also, it's probably easier to not consider each carry, because it may lead to duplicates. While you can prune some options, after that I would greedily select whichever number has the most possibilities (probably 5).
Oct 4 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by wukexin | last post: by
3 posts views Thread by Colin J. Williams | last post: by
7 posts views Thread by Corepaul | last post: by
5 posts views Thread by Steve | last post: by
8 posts views Thread by Mark | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.