sieve_primes: Find all primes up to a given positive integer

View source: R/primes.R

sieve_primesR Documentation

Find all primes up to a given positive integer

Description

This function implements the Sieve of Eratosthenes algorithm to find all prime numbers up to the given positive integer n. It returns a vector of integers representing the prime numbers.

Usage

sieve_primes(n)

Arguments

n

A positive integer specifying the upper limit for the prime numbers.

Value

A numeric vector of prime numbers up to n.

Examples

zulutils:::sieve_primes(10)
zulutils:::sieve_primes(20)


torfason/zulutils documentation built on Aug. 21, 2023, 5:46 p.m.