A little of coordination for Rosettacode
ixid
nuaccount at gmail.com
Tue Mar 19 10:32:51 PDT 2013
On Tuesday, 19 March 2013 at 17:18:01 UTC, bearophile wrote:
> ixid:
>
>> http://rosettacode.org/wiki/Prime_decomposition#D
>>
>> This will potentially return a 1 in the list of primes which
>> is a bug as 1 isn't prime.
>
> From Python code, hopefully more correct and much faster:
>
> http://codepad.org/N4A7kxE1
>
> Bye,
> bearophile
This method seems to be a lot slower than just adding an if
statement while giving the same answers (after sorting). For me
it took 1.5 seconds to decompose 2 to 100,000 compared to 150ms
for the method I posted above. Can you find an error in my method
or shall I post that? I'll add a cast(T) 1 to the if statement so
it can deal with big ints too.
More information about the Digitalmars-d-learn
mailing list