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.
It's a math precision issue. This is about integer arithmetics, floating point doesn't work.
2^31 * 17^2 * 969743 * 25772783 = 15511210043330986055303168
25! = 15511210043330985984000000 = 2^22 * 3^10 * 5^6 * 7^3 * 11^2 * 13 * 17 * 19 * 23
Having same issue. 25! results in 2^31 * 17^2
I am suspecting the fact that it's a big number somehow fools my tests . I am currently using this to see if a number is divisible entirely by another
float_div = factorial / prime
if float_div == int(float_div):
#carry on dividing by same prime
Anyone can give me a hint of what i am doing wrong?
thanks
@g964
I have exactly the same error. When I decompose a number n into its prime factors I should take the biggest powers of its prime and then dived by the next prime and so on. In this case the biggest power is of 2 is 31. I can say it differently. The number 3^10 * 5^6 * 7^3 * 11^2 * 13 * 19 * 23 is diveded by 2 (9 more times), so I cant move on to the next prime (3) till I end the devision by 2.
Thanks for your time.
"EDIT: I have found that 1551121e25 is 25 factorial."
No, it's not.
There is still a typo "iser_id" in the Note at very bottom of the instructions.
All languages have the decomposition of factorial(25) and 1571 people passed the kata...
You think... Don't post issues unless you are absolutely sure of your code and sure that all other codes are wrong. ost simply a question.
It's a loop inside another. And you have to take care also how internally
array_shift
works, maybe it changes the index of all the array elements. Your code is almost there, try not usingarray_shift
.array_sum
is a loop-alike method, so your code is O(n2). Please, read the posts below before creating your own, you're not the only one with that problem and it's been asked and answered several times already, mostly they post like you, with code so most of them are marked as having spoiler content and can't be seen for people who didn't complete the kata. Your code needs to be O(n) to pass.It's in the initial code: