Sequence of primes by trial division: Difference between revisions
Sequence of primes by trial division (view source)
Revision as of 03:43, 27 December 2022
, 1 year ago→Delphi: Add EasyLang
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
Jazzedpineda (talk | contribs) (→Delphi: Add EasyLang) |
||
Line 808:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/Sequence_of_primes_by_trial_division#Pascal Pascal].
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
func isPrime num . result$ .
if num < 2
result$ = "false"
break 1
.
if num mod 2 = 0 and num > 2
result$ = "false"
break 1
.
for i = 3 to sqrt num
if num mod i = 0
result$ = "false"
break 2
.
.
result$ = "true"
.
func primeSequence first last . sequence[] .
for i = first to last
call isPrime i result$
if result$ = "true"
sequence[] &= i
.
.
.
</syntaxhighlight>
=={{header|EchoLisp}}==
|