Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I wanted it to be consisted between all translations. This kata uses 64-bit type as
n
in all languages.Besides,
size_t
type is just alias ofunsigned long long
on x64 machines and, hence we're using RAX in NASM, I can make an assumption that target machine is indeed x64.Usually
size_t
is used for array indexes and that is exactly the main reason why it is used here.Thank you for the feedback.
I've changed the signature in sample tests and added
static
to solution function.Also thanks for the help with how I should change description for NASM. None of the available tutorials said anything about how to change description for the new language. Good to know that it's even more complicated with NASM.
I really don't think that two calls to
rand
are undefined behaviour since only thing that is not guaranteed is the order of the execution of these calls, but it doesn't really matter for the logic of my code.Description should be changed to clarify that numbers can be negative.
NASM translation added, please review ;)
I think you should update test cases (at least those for C#) for base 10, because for n = 5 correct answer is 142857 not 102040816326530612244897959183673469387755, because 5 is special case and period of 5 / 49 isn't the smallest parasite number possible. For n = 5 correct answer is period of 1 / 7.