# Can you get this math problem of the week?

Sum four DIgit Primes:

A, B, C and D represent different digits. AACA, ADDD, BCDB, and BDAC represent four different four-digit prime numbers. Determine the sum of all the four four-digit prime nimbers (AACA + ADDD + BCDB + BDAC).

### 5 Answers

Relevance
• 1 decade ago
Favorite Answer

I'm disappointed with myself that I couldn't do this problem

logically. I got a little way but it started getting complicated

and messy, so I had to resort to cheating.

Each of the 4-digit primes ends with a different digit, so each

of A, B, C and D must belong to 1, 3, 7 or 9, as these are the

only digits which can end a prime number of more than 1 digit

in length.

The possibilities for ADDD include : 1333, 1777, 1999, 3111,

3777, 3999, 7111, 7333, 7999, 9111, 9333 and 9777.

Of these, only 1777, 1999 and 7333 are primes.

So, A = 1 or 7, and D = 3, 7 or 9.

Utilising these facts, the only possibilities for AACA are :

1131, 1171, 1191, 7717, 7737 and 7797.

Of these, only 1171 and 7717 are primes.

So, C = 1 or 7.

So, (A = 1 and C = 7), or (A = 7 and C = 1)

Thus, (B = 3 and D = 9) or (B = 9 and D = 3).

Now test BCDB. It can only be 3193, 3793, 9139 or 9739.

Of these , only 3793 and 9739 are primes.

Therefore, C = 7, and thus, A = 1.

Now test BDAC. It can only be 3917 or 9317.

Of these, 3917 is the only prime.

Therefore, B = 3 and D = 9.

The 4-digit primes are thus :

1171, 1999, 3793 and 3917, which add to 10880.

EDIT: The reason I started with ADDD and AACA is because

these contain only 2 different digits and so the possiblities

are not as great as numbers with more digits.

Similarly, there are less possibilities in handling BCDB than

BDAC, meaning 3 different digits as opposed to 4.

• Login to reply the answers
• Anonymous
1 decade ago

Since the numbers you list end in A, D, B, and C, they must represent 1, 3, 7, and 9 in some order. 4-digit primes can't be even and can't end in 5.

I saw this problem posted in Yahoo! Answers earlier this week and, though I won't divulge the answer (the fun in a puzzle is in the solving), I will help with the fact that the only 4-digit primes containing the digits 1, 3, 7, and 9 are listed below. This will help you a great deal, I'm sure. Good luck!

1117, 1171, 1193, 1319, 1373, 1399, 1733, 1777, 1913, 1931, 1933, 1973, 1979, 1993, 1997, 1999, 3119, 3137, 3191, 3313, 3319, 3331, 3371, 3373, 3391, 3719, 3733, 3739, 3779, 3793, 3797, 3911, 3917, 3931, 7177, 7193, 7331, 7333, 7393, 7717, 7793, 7919, 7933, 7937, 7993, 9133, 9137, 9173, 9199, 9311, 9319, 9337, 9371, 9377, 9391, 9397, 9719, 9733, 9739, 9791, 9931, and 9973.

• Login to reply the answers
• 1 decade ago

10^3 * (2A + 2B) +

10^2 * (A +2D +C) +

10^1 * (C + 2D + A) +

A + B + C + D

OR

A * (2111) +

B * (2001) +

C * (111) +

D * (221)

This will form a unique combination of possibilities and hence

you could with a little effort get the actual sum.

This is not a math problem but rather a puzzle, that cannot be solved mathematically but needs to be "solved" using some tricks.

• Login to reply the answers
• 1 decade ago

A software (C language) solution. Output:

"I solved for AACA, ADDD, BCDB and BDAC!

The numbers: 1171, 1999, 3793 and 3917

And the sum is: 10880"

#include <stdio.h>

#include <math.h>

#include <conio.h>

#include <stdlib.h>

#define TRUE 1

#define FALSE 0

typedef int BOOL;

//protos...

BOOL IsPrime (int num);

BOOL bdacTest(int n)

{

char buff[5];

int i,j;

_itoa( n, buff, 10 );

for(i=0; i<3; i++)

for(j=i+1; j<4; j++)

if(buff[i] == buff[j] )

return FALSE;

return TRUE;

}

/*---------------

AACA, ADDD, BCDB, and BDAC represent four different numbers...

Easy way,

1.) see if num complies with BDAC config (basically, all diff)

if yes,

2.) create the other 3 numbers from BDAC.

If the other 3 are all prime, then we've solved...

----------------*/

void solve(int n)

{

char buff[5], b2[5], b3[5], b4[5];

int n2, n3, n4;

if( bdacTest(n) )

{

/*A good BDAC ... get arranging...*/

_itoa( n, buff, 10 ); //Buff == BDAC

// AACA,

b2[0]=b2[1]=b2[3]=buff[2];

b2[2]=buff[3];

b2[4]='\0';

// ADDD

b3[1]=b3[2]=b3[3]=buff[1];

b3[0]=buff[2];

b3[4]='\0';

// BCDB

b4[0]=b4[3]=buff[0];

b4[1]=buff[3];

b4[2]=buff[1];

b4[4]='\0';

// Make the strings into numbers...

n2 = atoi(b2);

n3 = atoi(b3);

n4 = atoi(b4);

// see if all are prime...

if(

IsPrime (n2) &&

IsPrime (n3) &&

IsPrime (n4)

)

{

puts("I solved for AACA, ADDD, BCDB and BDAC!");

printf("The numbers: %ld, %ld, %ld and %ld \n", n2, n3, n4, n);

printf("And the sum is: %ld\n", n+n2+n3+n4);

}

}

}

/*

Since the numbers you list end in A, D, B, and C, they must represent 1, 3, 7, and 9 in some order. 4-digit primes can't be even and can't end in 5.

*/

BOOL passLouiseRule(int n)

{

char buff[5];

int i,dig;

_itoa( n, buff, 10 );

for(i=0; i<4; i++)

{

dig=buff[i]-'0';

if(dig != 1 &&

dig != 3 &&

dig != 7 &&

dig != 9 )

return FALSE;

}

return TRUE;

}

// precondition: num >=2

// postcondition: returns 1 if num is prime, else 0

BOOL IsPrime (int num)

{

int divisor = 3;

int upperLimit = (int)(sqrt(num) + 1);

if(num == 2) // the only even prime

return TRUE;

if(num % 2 == 0) // other even numbers are composite

return FALSE;

while (divisor <= upperLimit)

{

if (num % divisor == 0)

return FALSE;

divisor +=2;

}

return TRUE;

}

int main()

{

int i;

for(i=1000; i<10000; i++) //sample all 4-digit nums

{

if(IsPrime(i) && passLouiseRule(i))

solve(i);

}

getch();

return 0;

}

Am I lazy, or what? :-)

• Login to reply the answers
• How do you think about the answers? You can sign in to vote the answer.
• 3 years ago

2 pies divided via 3 human beings is two/3 of a pie each and each. decrease each and each in 3 products and supply 2 products to each and each guy or woman and that way all 3 get the comparable quantity and comparable style of slices. Or decrease each and each pie in six slices (3 cuts is extra handy than angled cuts in any case) provide 2 products to each and each guy or woman. And in the event that they are nonetheless hungry, provide 'em 2 extra slices and each physique gets their hassle-free proportion!

• Login to reply the answers
Still have questions? Get your answers by asking now.