Soul FriendКод:
forprime(p = a, {b}, seq)
Evaluates
seq, where the formal variable p ranges over the prime numbers between the real numbers
a to
b, including
a and
b if they are prime. More precisely, the value of
p is incremented to
nextprime(p + 1), the smallest prime strictly larger than
p, at the end of each iteration. Nothing is done if
a >
b.
Код:
? forprime(p = 4, 10, print(p))
5
7
-- 01.08.2018, 10:08 --И надо найденные простые в отрезке

записать группой в векторе.
Код:
? v=[];n=20;forprime(p=(n-1)^2,n^2,v=concat(v,p));print(#v," primes found: ",v)
6 primes found: [367, 373, 379, 383, 389, 397]
Для

, простые числа между

и

помещаются в вектор
vНа планшете для

считает 8 секунд, находит 8651 простых чисел.