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.
Nice little code golf kata, with many different solutions.
Approved!
54 bytes
Definitely an issue. Without sufficiently large values of
n
, a simple for loop will do. However, larger values ofn
will require values ofr
increasingly close to1
to avoid overflow or underflow.IMHO, this kata would work much better with integer-only inputs, with output taken modulo a large prime. This would eliminate all accuracy concerns.
yup, I definitely made a mistake
The reference solution is broken. ( The large fixed tests are as well. ) This has been raised as the spoiler issue.
I believe the reference solution is currently broken. It does not apply the modulus correctly, so it often produces wrong answers for large inputs.
same. Even following along with the "video" the author describes, my solution passes around 30 per run.
I'm in the same boat. I'm pretty sure I have the right formula but only pass around 30 large tests.
Is the reference solution correct? My solutions passed 25 tests including some big ones, so I'm not sure what could be wrong... (I can't see the spoilers.)
Oh, it's the integral from
0
ton
! I honestly absolutely didn't read that in it.$\int_0^n$
This comment is hidden because it contains spoiler information about the solution
Me too.
Done, thanks for the tip.
Loading more items...