All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Finding numbers (Posted on 2013-02-12)
ABC and CBA are two three-digit decimal numbers, with A and C different non-zero digits. Squares of these numbers are five-digit numbers DEFGH and HGFED respectively. Find all such three-digit numbers.

 No Solution Yet Submitted by Danish Ahmed Khan No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 2

Attempting to find solutions where each letter represented a different digit, I found none. So assigning the same digit to different letters was allowed.

However, A and C are specified to be different from each other. The solutions which fit that are:

`ABC  CBA      DEFGH  HGFED102  201      10404  40401103  301      10609  90601112  211      12544  44521113  311      12769  96721122  221      14884  48841201  102      40401  10404211  112      44521  12544221  122      48841  14884301  103      90601  10609311  113      96721  12769`

were it not for the requirement that A and C be different, the following would have worked:

`101  101      10201  10201111  111      12321  12321121  121      14641  14641202  202      40804  40804212  212      44944  44944`
` `

DEFDBL A-Z
CLS
FOR a = 1 TO 9
FOR b = 0 TO 9
FOR c = 1 TO 9
IF c <> a THEN
abc = 100 * a + 10 * b + c
cba = 100 * c + 10 * b + a
abc2 = abc * abc
cba2 = cba * cba
abc2s\$ = LTRIM\$(STR\$(abc2))
cba2s\$ = LTRIM\$(STR\$(cba2))
IF LEN(abc2s\$) = 5 AND LEN(cba2s\$) = 5 THEN
good = 1
FOR i = 1 TO 5
IF MID\$(abc2s\$, i, 1) <> MID\$(cba2s\$, 6 - i, 1) THEN good = 0: EXIT FOR
NEXT
IF good THEN PRINT abc; cba, abc2; cba2
END IF
END IF
NEXT
NEXT
NEXT

PRINT : PRINT
FOR a = 1 TO 9
FOR b = 0 TO 9
FOR c = 1 TO 9
IF c = a THEN
abc = 100 * a + 10 * b + c
cba = 100 * c + 10 * b + a
abc2 = abc * abc
cba2 = cba * cba
abc2s\$ = LTRIM\$(STR\$(abc2))
cba2s\$ = LTRIM\$(STR\$(cba2))
IF LEN(abc2s\$) = 5 AND LEN(cba2s\$) = 5 THEN
good = 1
FOR i = 1 TO 5
IF MID\$(abc2s\$, i, 1) <> MID\$(cba2s\$, 6 - i, 1) THEN good = 0: EXIT FOR
NEXT
IF good THEN PRINT abc; cba, abc2; cba2
END IF
END IF
NEXT
NEXT
NEXT

 Posted by Charlie on 2013-02-12 17:49:03

 Search: Search body:
Forums (0)