- #1

- 18,842

- 9,027

24 + 3 = 27 and 24 * 3 = 72

and

47 + 2 = 49 and 47 * 2 = 94

But there is only one pair of numbers with a triple-digit result and its reversion.

What are the 2 numbers?

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Greg Bernhardt
- Start date

- #1

- 18,842

- 9,027

24 + 3 = 27 and 24 * 3 = 72

and

47 + 2 = 49 and 47 * 2 = 94

But there is only one pair of numbers with a triple-digit result and its reversion.

What are the 2 numbers?

- #2

Hurkyl

Staff Emeritus

Science Advisor

Gold Member

- 14,967

- 19

Is it fair game to exhaust these via computer?

- #3

brum

- 81

- 0

seeing as there isn't a solution under a million... I am assuming you can use a computer

update: arg.. it's too big for QBASIC...

update: arg.. it's too big for QBASIC...

Last edited:

- #4

hypnagogue

Staff Emeritus

Science Advisor

Gold Member

- 2,277

- 2

Anyway, I have the solution from a Matlab program I wrote but after your post I decided to wait on Greg's input into this. In the future I think it should be more explicit what resources are and are not allowed in general (eg I would think google is a no-no for any of these) and in particular cases (eg the acceptability of the use of a computer program for a question like this one).

- #5

Hurkyl

Staff Emeritus

Science Advisor

Gold Member

- 14,967

- 19

- #6

- 18,842

- 9,027

hmmm... well I suppose use a computer, except if it's a program especially for that calculation.

- #7

dduardo

Staff Emeritus

- 1,901

- 3

I too have come up with an answer. Instead of matlab, I used c++.

[edit]

So is that a yes for a program. Its my own code. See below:

#include <iostream>

#include <sstream>

#include <string>

using namespace std ;

bool reverse_equal( int x , int y )

{

string s1 , s1_flip = "" , s2 ;

ostringstream s1_stream , s2_stream ;

int xy_flip ;

s1_stream << x+y ;

s2_stream << x*y ;

s1 = s1_stream.str() ;

s2 = s2_stream.str() ;

for( int z = s1.length() - 1; z >= 0 ; z-- )

s1_flip += s1[z] ;

if( s1_flip == s2 ) return true ;

else return false ;

}

int main( void )

{

for( int x = 1; x < 1000 ; x++ )

{

for( int y = 1; y < 500 ; y++ )

{

if( reverse_equal( x , y ) )

{

cout << "X: " << x << endl ;

cout << "Y: " << y << endl ;

cout << "X+Y: " << x+y << endl ;

cout << "X*Y: " << x*y << endl << endl ;

}

}

} }

Answer :

X: 497

Y: 2

X+Y: 499

X*Y: 994

[edit]

[edit]

So is that a yes for a program. Its my own code. See below:

#include <iostream>

#include <sstream>

#include <string>

using namespace std ;

bool reverse_equal( int x , int y )

{

string s1 , s1_flip = "" , s2 ;

ostringstream s1_stream , s2_stream ;

int xy_flip ;

s1_stream << x+y ;

s2_stream << x*y ;

s1 = s1_stream.str() ;

s2 = s2_stream.str() ;

for( int z = s1.length() - 1; z >= 0 ; z-- )

s1_flip += s1[z] ;

if( s1_flip == s2 ) return true ;

else return false ;

}

int main( void )

{

for( int x = 1; x < 1000 ; x++ )

{

for( int y = 1; y < 500 ; y++ )

{

if( reverse_equal( x , y ) )

{

cout << "X: " << x << endl ;

cout << "Y: " << y << endl ;

cout << "X+Y: " << x+y << endl ;

cout << "X*Y: " << x*y << endl << endl ;

}

}

} }

Answer :

X: 497

Y: 2

X+Y: 499

X*Y: 994

[edit]

Last edited:

- #8

- 18,842

- 9,027

dduardo gets the point!

Share:

- Replies
- 74

- Views
- 1K

- Replies
- 10

- Views
- 460

- Last Post

- Replies
- 30

- Views
- 2K

- Replies
- 9

- Views
- 801

- Replies
- 4

- Views
- 289

- Last Post

- Replies
- 5

- Views
- 439

- Last Post

- Replies
- 7

- Views
- 192

- Last Post

- Replies
- 13

- Views
- 400

- Last Post

- Replies
- 24

- Views
- 456

- Replies
- 42

- Views
- 993