RosettaCodeData/Task/Emirp-primes/Maple/emirp-primes.maple
2023-07-01 13:44:08 -04:00

22 lines
553 B
Text

EmirpPrime := proc(n)
local eprime;
eprime := parse(StringTools:-Reverse(convert(n,string)));
if n <> eprime and isprime(n) and isprime(eprime) then
return n;
end if;
end proc:
EmirpsList := proc( n )
local i, values;
values := Array([]):
i := 0:
do
i := i + 1;
if EmirpPrime(i) <> NULL then
ArrayTools:-Append(values, i);
end if;
until numelems(values) = n;
return convert(values,list);
end proc:
EmirpsList(20);
EmirpPrime~([seq(7700..8000)]);
EmirpsList(10000)[-1];