Draft:Ripple Sieve: Difference between revisions

From Wikipedia, the free encyclopedia

Content deleted Content added


 

Line 19: Line 19:

==Algorithm Description==

==Algorithm Description==

The Ripple Sieve utilises a “seed” value to initialise a “ripple” that grows linearly, creating a second-order arithmetic progression. The seed values start at 1 incremented by 2 to produce odd number seeds up till the seed value reaches (n – 6) / 3.

The Ripple Sieve utilises a “seed” value to initialise a “ripple” that grows linearly, creating a second-order arithmetic progression.

The seed values start at 1 incremented by 2 to produce odd number seeds up till the seed value reaches (n – 6) / 3.

===Iterative Logic===

===Iterative Logic===


Latest revision as of 23:21, 21 January 2026

Efficient prime sieve algorithm focusing on odd integers using quadratic increments

The Ripple Sieve is a prime sieve algorithm that generates all odd prime numbers up to a given limit n. Developed by Rayan Ivaturi, the algorithm is a variant of the Sieve of Eratosthenes that optimises the sieving process by focusing exclusively on odd integers and utilising a dynamic quadratic increment, referred to as a “ripple,” to identify composite numbers.

Mathematical Recognition

[edit]

The mathematical properties of the Ripple Sieve were formally recognised in 2017 with the acceptance of sequence (sequence A281813 in the OEIS) in the Online Encyclopedia of Integer Sequences (OEIS). The sequence defines the number of “ripple” operations required for the first n odd numbers, providing a basis for analysing the algorithm’s efficiency and computational density.

Algorithm Description

[edit]

The Ripple Sieve utilises a “seed” value to initialise a “ripple” that grows linearly, creating a second-order arithmetic progression.
The seed values start at 1 incremented by 2 to produce odd number seeds up till the seed value reaches (n – 6) / 3.

For seed s, starting from 1 incremented by 2, the algorithm initialises:

  • A starting index: sum = seed + base ripple
  • An initial base ripple: ripple = 2 * seed + 6

In each step of the inner loop, the ripple is incremented by 8, and the next composite is found by adding this new ripple to the current sum. This ensures that the algorithm only marks odd composite numbers, effectively skipping even integers.

Comparison with Sieve of Sundaram

[edit]

While both the Sieve of Sundaram and the Ripple Sieve aim to exclude even numbers, their implementations are mathematically distinct:

  • Sieve of Sundaram: Relies on the algebraic identity $i + j + 2ij$ to mark indices in a reduced array.
  • Ripple Sieve: Operates on the values themselves using a second-order difference of 8 to skip even multiples.

The following is the original implementation in Python:

def ripple_sieve(n):
    primes = [False] * n
    seed_limit = (n - 6) // 3    
    
    for seed in range(1, seed_limit, 2):        
        ripple = 2 * seed + 6
        sum_val = seed + ripple        
        
        while sum_val < n:
            primes[sum_val] = True
            ripple += 8
            sum_val += ripple

    return [i for i in range(3, n, 2) if not primes[i]]
  • Ivaturi, Rayan. Sequence A281813, The Online Encyclopedia of Integer Sequences (2017).

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version