Jump to content

Can you find the Number ?

Featured Replies

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 ?

9 hours ago, Commander said:

Can you find the original number ABCD ?

 

Spoiler

Answer: ABCD=3861

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

 

 

  • Author
16 hours ago, Ghideon said:

Ghideon :

Absolutely Right ! Well done !!

 

 

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.

 

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.

  • Author

Sensei only 7722 will make it !

Which is also double of 3861

Edited by Commander
To add value

14 hours ago, Commander said:

Sensei only 7722 will make it !

Which is also double of 3861

Correct answer.

Test.zip

#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

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.