Toolbox-XToolbox-X

Find Prime Numbers

Returns all prime numbers within a specified numeric range.

findPrimeNumbers

Finds all prime numbers between the start and end values (inclusive). If start > end, the range is automatically normalized.

Function Signature

function findPrimeNumbers(start?: number, end?: number): number[]

Parameters

  • start (number, optional): The start of the range. Defaults to 1.
  • end (number, optional): The end of the range. Defaults to 1000.

Returns

  • number[]: An array of prime numbers within the specified range.

Examples

playground.ts

Notes

  • Automatically corrects ranges where start > end.
  • Performance is optimal for small-to-medium ranges.

Aliases

  • getPrimeNumbers

Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)

On this page