# Can you find the Number ?

## Recommended Posts

There is a four-digit number ABCD, where A, B, C, D each represents a different digit from 1 to 9.

ABCD is divisible by 13,  BCDA is divisible by 11, CDAB is divisible by 9, and DABC is divisible by 7.

Can you find the original number ABCD ?

##### Share on other sites
9 hours ago, Commander said:

Can you find the original number ABCD ?

Spoiler

3861/13=297
8613/11=783
6138/9=558
1386/7=198

##### Share on other sites
16 hours ago, Ghideon said:

Ghideon :

Absolutely Right ! Well done !!

##### Share on other sites
1 hour ago, Commander said:

Well done !!

Thanks!

Below is a hint if someone should be interested:

Spoiler

CDAB is divisible by 9 means that ABCD,  BCDA and DABC are also divisible by 9.
13, 11 and 7 are primes

so:
ABCD is divisible by 13x9,  BCDA is divisible by 11x9 and DABC is divisible by 7x9.

##### Share on other sites
On 10/15/2019 at 12:26 PM, Commander said:

There is a four-digit number ABCD, where A, B, C, D each represents a different digit from 1 to 9.

Since original puzzle has been solved, I have puzzle for you Commander: what four-digit number will be solution, if any digit might be used multiple times.

##### Share on other sites

Sensei only 7722 will make it !

Which is also double of 3861

Edited by Commander

##### Share on other sites
14 hours ago, Commander said:

Sensei only 7722 will make it !

Which is also double of 3861

#include <stdio.h>

int get( int i, int j ) {
j = 3 - j;
for( ; j > 0; j-- ) i /= 10;
return( i % 10 );
}

int swap( int i, int a, int b, int c, int d )
{
int result;
result = get( i, a ) * 1000;
result += get( i, b ) * 100;
result += get( i, c ) * 10;
result += get( i, d ) * 1;
return( result );
}

bool check( int i, bool verbose = false ) {
if( get( i, 0 ) == 0 ) return( false );
if( get( i, 1 ) == 0 ) return( false );
if( get( i, 2 ) == 0 ) return( false );
if( get( i, 3 ) == 0 ) return( false );

int j;
j = swap( i, 0, 1, 2, 3 );
if( verbose ) printf( "ABCD %d\n", j );
if( ( i % 13 ) != 0 ) return( false );
j = swap( i, 1, 2, 3, 0 );
if( verbose ) printf( "BCDA %d\n", j );
if( ( j % 11 ) != 0 ) return( false );
j = swap( i, 2, 3, 0, 1 );
if( verbose ) printf( "CDAB %d\n", j );
if( ( j % 9 ) != 0 ) return( false );
j = swap( i, 3, 0, 1, 2 );
if( verbose ) printf( "DABC %d\n", j );
if( ( j % 7 ) != 0 ) return( false );
return( true );
}

int main() {
for( int i = 0; i < 10000; i++ ) {
if( check( i ) ) {
printf( "Result %d\n", i );
check( i, true );
}
}
}

Edited by Sensei

## Create an account

Register a new account
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}