Descending primes: Difference between revisions
m
→Prolog
m (→Prolog) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1,237:
len = 87</pre>
=={{header|Prolog}}==
{{works with|swi-prolog}}© 2023<syntaxhighlight lang="prolog">
isPrime(2).
isPrime(N):-
between(3, inf, N),
N /\ 1 > 0,
M is floor(sqrt(N)) - 1, % reverse 2*I+1
Max is M div 2,
Line 1,499:
{{libheader|Wren-perm}}
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
import "./math" for Int
import "./seq" for Lst
Line 1,512 ⟶ 1,511:
.sort()
System.print("There are %(descPrimes.count) descending primes, namely:")
{{out}}
|