Skip to content

prime_count(a,b) is slow for large a and b, with |a-b| small. #78

@trizen

Description

@trizen

For example, the following command takes about 10 seconds on my system:

time perl -Mntheory=:all -E 'use bigint; say prime_count(2**63 - 10, 2**63 + 1000)' 

However, getting the primes in the same range is very fast:

time perl -Mntheory=:all -E 'use bigint; say scalar @{primes(2**63 - 10, 2**63 + 1000)}'

Notice that for small enough a and b, the prime_count function is fast:

time perl -Mntheory=:all -E 'use bigint; say prime_count(2**50 - 10, 2**50 + 1000)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions