Skip to main content
The National Cipher Challenge

Reply To: Programming

A Tale of 2 Secrets Forums T.E.M.P.E.S.T. Programming Reply To: Programming

#113017
ByteInBits
Participant

Another little task to while away the time 😉

A RATHER LONLY NUMBER
=====================
Take a positive (base 10) integer X > 100 not having a 1 or 0 as its last digit.
Let Y = the last digit of X.
Let Z = X*Y.
Remove the last digit (Y) from X and place it as the first digit of X giving W.
If W is equal to Z then X is the number we seek.

Example using a 4 digit integer 1234

[X=1234] [Y=4] [Z=X*Y=4936] [W=4123] -> W = Z? 4123 = 4936? False.
So X = 1234 is NOT the number we seek.

Task
Write Code to find the first integer X that satisfies the condition.
(Hint X is below 1,000,000)

Post your code and its answer.

Report a problem