Skip to content

Bug in atkinsSieve and eratosthenesSieve functions #1

@Shivaji-Shill

Description

@Shivaji-Shill

The functions atkinsSieve and eratosthenesSieve have some bugs:

  1. In atkinsSieve:

    • The loop for(i = 7; i < limit; i++) does not include the limit itself, so primes equal to the limit are missed.
  2. In eratosthenesSieve:

    • The sieve initialization and result extraction are incorrect, leading to wrong prime numbers.
    • Looping logic skips numbers incorrectly.

Suggested fix: Adjust loop limits and simplify sieve logic.

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