might be best to add a test case to guard against test suite hacking
Far too few test cases. In fact, a serious issue with this problem is that there are too few parasitic numbers that will fit into even 64 bits for most values of n.
I've added some test cases, that will make it a bit more difficult to game this problem.
Cases 5 and 7 are identical, and I believe they are both wrong. 5 x 142857 = 714285. Isn't this a parasitic number? What am I missing?
Can the problem creator disqualify "solutions" that cheat? There should be a point penalty (-200) associated with cheating too.
There is 4, not 5
I mis-typed. 4 x 142857 = 571428, which is a shift right of 2. Incidentally, both n = 4 and 5 both make parasitic pairs with 142857.
Thus it is not a 4-parasitic number. It doesn't meet the definition. Nevertheless is a great example of a cyclic number. You can get different cyclic permutations when multiply 142857 by 1, 2, 3, 4, 5 and 6. For 5 you got shift by one digit, therefore it's 5-parasitic.
Ahhh, I see! Thanks, Jan - I get it now!
Not actually a general solution. Takes advantage of limited test cases.
Are all the three given point in the same line?
Set the array elements whose value is 13 to 0
intersection of matrices
Concatenate two strings
Flip the vector from right to left
Is my wife right? Now with even more wrong husband
Right and wrong
Sum My Indices
Flip the bit
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office