Shift the digits code-golf integer arithmetic restricted-time
Given a single positive integer (sayHere, x (supplied as input), find the smallest positive integer, after being multiplied by and xn, produces a result equivalent to shifting the positive integer(the result of your computation) are both positive integers. Under a formula, it basically means n * x = n shifted. Find n (n > 0)
. Find n.
Here's an example of shifting:
123456789 -> 912345678
abcdefghi -> iabcdefgh (letters = any 0~9 digit)
123 -> 312
Rules
- Preceding zeros count after shifting. If the number is
10
and is multiplied by0.1
(0.1
isn't a valid input), the result is1
, which isn't equal to01
(10
after shifting). - Your code has to run on Try It Online without timing out.
- If your number only has one digit, the shifted result is your number:
1 -> 1
4 -> 4
9 -> 9
Test cases
Just to show that it's possible ...
9 -> 10112359550561797752808988764044943820224719
(In this test case, x = 9 and n = 10112359550561797752808988764044943820224719.
n shifted = n * x = 91011235955056179775280898876404494382022471)
Don't believe it? Try it online.