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.
A more traditional parser. Note the use of a container class ("State" in this case) to provide a mechanism for the inner functions to modify the variables. This is just to follow the initial architecture of a single parse function -- a better way would be to create a Calculator class with a parse() method.
Though this is a sensible and elegant algorithm, I would not qualify it as especially fast, as the title suggests.
It definitely is fast enough for small primes, but try running this one for example:
Here an output of the timing for this test on my machine:
I wrote up an alternative version, which is able to produce output pretty fast for larger numbers as well.
Here the timing of an example run using this code:
So let's say that there is room for improvement ;-)
Kind regards,
Maurice