2
Here, x (supplied as input) and n (the result of your computation) are both positive integers. n * x = n shifted. Find n.
Here's an example of shifting:
123456789 -> 912345678
abcdefghi -> iabcdefgh (letters = any 0~9 digit)
123 -> 312
Shifting only happens once to the right. Shifting left, e.g.
123456789 -> 234567891
is not a valid shifting.
Rules
- Preceding zeros count after shifting. If the number is
10and is multiplied by0.1(0.1isn't a valid input), the result is1, which isn't equal to01(10after shifting). - If your number only has one digit, the shifted result is your number:
1 -> 1
4 -> 4
9 -> 9
- Given enough time and resources, your program/function should work for any x input, but you only have to support x in the range
[1,9]without timing out on Try It Online.
Test cases
For more test cases, this is OEIS A092697.
1 -> 1 (1 * 1 = 1 shifted.)
9 -> 10112359550561797752808988764044943820224719
(In this test case, x = 9 and n = 10112359550561797752808988764044943820224719.
n shifted = n * x = 91011235955056179775280898876404494382022471)
6 -> 1016949152542372881355932203389830508474576271186440677966
```
7Can we have some more test cases / a fully working reference program? I'm still a little unsure of what the program needs to do. – Lyxal – 2020-02-18T10:37:31.360
@Lyxal Assuming $x\le9$, I think the longest output is for $x=6$, for which I've found
1016949152542372881355932203389830508474576271186440677966. – Arnauld – 2020-02-18T11:49:15.097Is the task actually possible for any input 10 or bigger? If I'm understanding right your rule about leading zeroes, the shifted value always has the same number of digits as the original, where the multiplied value has more digits in this case. – xnor – 2020-02-18T11:49:50.110
Agree with @xnor, I doubt if this has solutions ever for $x>9$ without leading zeros because the numbers before and after transformation have the same length – Shieru Asakoto – 2020-02-18T12:04:34.427
3
This is https://oeis.org/A092697. Or, rather, the smallest possible outputs are in the sequence. I found this by Googling the large number given for
– xnor – 2020-02-18T12:18:01.980x=9. One formula given says the output isx*(10^m-1)/(10x-1)for the smallestmthat makes this a whole number.4Just to be clear, the problem with the current spec is Given enough time and resources, your program/function should work for any x input, since the sequence is apparently not defined for $x>9$. – Arnauld – 2020-02-18T12:37:02.050