Hello, pranay!

If we have an integer (say ) which ends in either 1, 3, 7 or 9,

then how can one find another integer having at most the same number of digits as

but when cubed would end in exactly the same digit as .

E.g. .if a = 123, then the required number is 927

because 123 ends in 3 and 923^3 also ends in 3.

. . It could beany3-digit number (or smaller) ending in 7.

Another example: .a = 435621, then required number is 786941.

. . It could beany6-digit number (or smaller) ending in 1.

Just make a list of the endings of cubes . . .

. .aends in: . .a^3ends in:

. . - - - - - - - - - - - - - - - - - -

. . . . . 0. . . . . . . . . 0

. . . . . 1. . . . . . . . . 1

. . . . . 2. . . . . . . . . 8

. . . . . 3. . . . . . . . . 7

. . . . . 4. . . . . . . . . 4

. . . . . 5. . . . . . . . . 5

. . . . . 6. . . . . . . . . 6

. . . . . 7. . . . . . . . . 3

. . . . . 8. . . . . . . . . 2

. . . . . 9. . . . . . . . . 9

Example: .a = _ 4

. . .Then: .b = _ 4

Example: .a = _ _ 3

. . .Then: .b = _ _ 7