You are here: Symbol Reference > MtxVec Namespace > Classes > TVec Class > public > TVec.PrimeNumbers Method
MtxVec VCL
ContentsIndex
PreviousUpNext
TVec.PrimeNumbers Method

Fills vector with prime numbers, starting from 2 up to the value of n.

Pascal
function PrimeNumbers(n: integer): TVec;

Fills calling vector with prime numbers, starting from 2 up to the value of n. The memory for at least n elements is allocated. The maximum value of n is 1000. The prime numbers are fetched from a precreated table.

var a: TVec; begin CreateIt(a); try a.PrimeNumbers(10); // a = [2,3,5,7] finally FreeIt(a); end; end;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!