Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func boolean: isPrime (in integer: number) is func
|
||||
result
|
||||
var boolean: result is FALSE;
|
||||
local
|
||||
var integer: count is 2;
|
||||
begin
|
||||
if number = 2 then
|
||||
result := TRUE;
|
||||
elsif number > 2 then
|
||||
while number rem count <> 0 and count * count <= number do
|
||||
incr(count);
|
||||
end while;
|
||||
result := number rem count <> 0;
|
||||
end if;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var integer: i is 42;
|
||||
var integer: n is 0;
|
||||
begin
|
||||
for i range 42 to integer.last until n >= 42 do
|
||||
if isPrime(i) then
|
||||
incr(n);
|
||||
writeln("n = " <& n lpad 2 <& i lpad 16);
|
||||
i +:= i - 1;
|
||||
end if;
|
||||
end for;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue